Tuesday, November 11, 2008

Starting Programming - The basics steps

let me tell you an easy way to learn programming.

is it C?

Search on Google "C tutorials"
http://www.google.com/search?q=c+tutorials

Download some..

Start your C editor program, if you are still on Turbo C, that is the best, the reason is very simple, it do not correct your mistakes automatically (many new compilers do that) and in turn you wont get to know your errors, which in turn will bug you later. However, if you are too annoyed with the blue screen, most of the new programmers are, you are not alone but if you really feel you can't do programming on that, try Dev-C++ compiler which is freely available on http://www.bloodshed.net

So here you are, remember one thing which I learned from my own experience, you cant achieve anything until you practice for it, the more you will practice the more experience you will gain.

There are 5 basic functionality steps of programming you need, and they are common, you will find them in nearly every language.

From here try each functionality step-by-step:
1- Variable types
They are really very necessary, how many bytes a character takes in the memory, how many bytes for integer, what does long character means, what are float numbers? You need to memorize all of them, without them, you cant take a single step, remember those will let you know that how a character is different from an integer down there under the compiler, got this? Bingo!

2- The Variable
If there wont be a variable, you wont be able to write a simple line of code. These are the boxes in which you carry your roast chicken pieces around and throw them away when you don't need them. These chicken roast pieces get compared with each other, loops (machines) work on them and at the last, you throw away the boxes which are not required or which are empty and store the useful roast chicken pieces in the fridge (memory) and start using the same boxes for other pieces of finest quality meat. mm Yum Yum!

3- Print or Echo
Try printing something on your screen, then add line breaks, special characters, see what is the difference. This is necessary as this is the beauty of working with software that you see the results on every step, by just hitting F9 (believe me in embedded systems, this alone is most annoying thing, you will need to go through 4 steps just to see that if LED is blinking or not and in many cases you wont have that LED too.)

4- if-else conditions
The most important structure of any programming language, with out them, you cant put any logic in there, try using all of them, if, else, else if, then when you go on Linux, its if-then statements there, use them all, try comparing characters, integers, hex numbers, see in the basics how they are getting compared.

5- Loop statements
Loops are basically programmer's life savors, don't get scared from them, if they wont exist, you may have to write hundreds and thousands of code lines just to compare a variable with its many possible variants, but here they save your lives. Learn them all, for, while, do while, they are indeed very simple. Just you need to take care of three basic things, a start point, an end point and a variable in between which will increment the value of start point and will increment it until the end point, got that point? You are star!

After them the most scary thing in C are pointers, believe me they are not scary at all, if you master the 5 basic functionality steps above, the pointers will prove piece of cake (they did, in my case and I am no better than you).

And at the last but not the least, the basic stone of programming is the programmer his/herself. For programming you must have To-do attitude, now whats that?

To-do attitude
You have been given a task, you even don't know the ABC of that task, you don't know about the pre-requisites which are necessary to carry out that task, but you have To-do attitude, alone that is enough. To-do attitude means, whatever comes in your way you will do that, you must have the hunger to learn, you must have the spark to do. There is nothing in this world, which you can't do! ;)

So, brovs, thats it for now, open your blue screens and smash that programming monster down, but in the mean time, always remember, the programmer of the programmers, Allah!

See you another time!

No comments: