Archive for March, 2011

De-Mystifying Programming

Sometimes last year I wrote a kind’a controversial post about how difficult programming is. It generates quite a lot of ruckus in the comments. Well see this as an opposite view of that post.

One thing is clear though, I still maintain that programming can not be learnt in 24 hours. I also still maintain that just as prescribing aspirin for headache (and it works) doesn’t make me a medical doctor, writing hello world (or programs in that line) doesn’t make you a programmer.

To start demystifying programming, we need to start from the basics. The first question we need to answer is this: What is a computer. I’ll give what I consider the most basic of definitions here. A computer is an ELECTRONIC device, that can take data (INPUT), perform some actions on the data (PROCESS), save the data and the result of the PROCESSing the data if necessary (STORAGE) and gives a meaningful result (OUTPUT). From my definition above I could say COMPUTER = INPUT + PROCESS + STORAGE + OUTPUT.

Programming is a kind of HOW to get the computer to behave as described above. Since the computer is an electronic device, it operates on a binary logic. ON or OFF, TRUE or FALSE, 1 or 0, etc. So to make the computer do those stuffs above we need to find a way to tell it in binary. This gives birth to the first programming languages. Programmers have to string together a whole lotto 1s and 0s to make the computer do simple tasks. We have evolved since then. These days we now have compilers and interpreters that allows us to speak more human-readable language to the computer, they then helps to convert the human readable language to something that the computer can understand.

Every program you write, even the most complex will have at least one of INPUT, PROCESS, STORAGE or OUTPUT. Take a sample code that adds two arbitrary numbers a and b to give you a third number c

INPUT = a, b

PROCESS = + (addition)

OUTPUS = c

c = a + b

Here the process is a simple addition. In some cases the process might be computing the age of a dinosaur based on some bone samples found in Alaska. The concept remains the same.

INPUT = bone sample

PROCESS = compute age of dinosaur

STORAGE = save bone sample for future use

OUTPUT = age of dinosaur

And that is all. Programming is all about those four things.

Comments (1)