My Adsense

Monday, August 31, 2009

Basics of Programming: Part 1

We know computer only understands 1s and 0s. Computers do works according the set of these 1s and 0s. These 1s and 0s are called Machine Language.

At the early time of computing, programmers instruct computers by writing directly into Machine Language. But as times go on, works for the computers rises rapidly. And it was very tough for the programmers to write these instructions again and again for separate command. So, they define some set of Machine Code dedicated for some specified works and give them appropriate name. These names are called Keywords. For example: ADD for addition, SUB for subtraction etc. This language is called Assembly Language.

After some times, the keywords weren’t enough for the programmers. So, here comes the thinking of a ‘Set of Keywords’ or Programming Language or High Level Language. Programmers write their program into these languages and these instructions were translated into the machine language for execution. The translator which translates the high level language into machine language is called Compiler. Now a day many compilers are available to write programs.
So, we can say that, computers execute the instructions that are translated into its native language, or Machine Language.

Now, the next question arises, how it deals with data? Suppose a sequence of 1s and 0s are sent to a programmer and also told that “It is data”. Though the programmer knows how to deal with data, but he would reply, “What operations can I do with this data?”. So, we also have to say instruct him he could do some certain operations with this data, and some operations can’t be done.
No matter what are we sending, computer first translates the code into machine language and then stores it. While storing, it also needs some rules and regulations on which it takes the decision of the operations that are valid for that data or not. These rules and regulations are called types. That means, data has types.
So, type defines which operations are valid for that data and which aren’t. We can also call it as Data Type. The main data types one compiler can understand are, Integer, Float, Character, Boolean etc.

So, we now know how the computer deals with data. But how does it store these into its storage?
We can say the storage as Memory. A memory is divided into hundreds and thousands of memory cell. Each of the memory cell has an address and also can store data in it. So, we can say, memory has two parts. Address and Data storage place.

To store something in memory, we can instruct the machine to do so in two ways. We can specify the address of the memory to store the data or we can just ask to store where ever it likes to store. In the second condition, we don’t know the address where the data is going to. To reuse the data in future, instead of retrieveing the memory address of it, we rather give it a name. That means, we give a name to the memory address where the data is going. This name is called Variable Name, and the memory place is called the Variable. So we put our data into the variable and recall the value using the name of the address we have declared before.

No comments: