Zyra's website //// Computers //// Science //// Site Index

Computer Programming Easily Explained

Here on this page is an easy explanation of computer programming, how it's done, what it's about, and how you can do it. The fundamental concept of computer programming requires no high-tech mystery to it. I can explain it in easy terms which I think anyone can understand.

For a long time computer programming had a mystique about it like Rocket Science as if you needed to be a boffin to understand it. Well, although it helps, it's not required. The other problem which gets in the way of having an understanding of computer programming is the debasement of computers by ignorantly-run shops and such operating systems as Microsoft Windows turning computers into executive toys, and the general notion that folk aren't clever enough to ever understand computers. If the same thing had happened to televisions because people could never understand how to use the remote control, televisions would now just be a thing you switch on and they just shows restful fish all of the time, rather than there being any programmes.

With real computer programming, once you get rid of all this "Windows" nonsense, and some of the mythology commonly believed, the average computer becomes a powerful scientific device which YOU CONTROL. This was true directly with "home computers" in the 1980s, but you can also make this true with a modern PC by getting rid of the veneer of windowishness and getting at the nitty-gritty. At the heart of it, the average computer you have on the table is probably more powerful computationally than the main computer at the university at the time I studied for my degree in Computer Science, and probably more powerful than the Mission Control computer when NASA put a man on the moon.

To explain computer programming, let's imagine a science fiction scenario where you have just taken delivery of a household robot which can do the housework. You might want to command it directly by saying thing like "vacuum the carpets", but supposing you were going to go out for a couple of hours and you wanted to get all the housework done while you were out, you might write a LIST and give it to the robot. For example:

1. wash the dishes
2. vacuum the carpets
3. iron the clothes

Computers in their real state do what you tell them to, and they don't mind you making lists of things for them to do. So, when you return, the household robot has completed the tasks on the list and performed them in sequence.

Computer programs are lists of things for a computer to do, and the machine will obey the commands in sequence until the list ends.

The situation gets interesting when you can put conditional commands in such as:

1. If there's any rubbish in the waste bin, empty it out into the skip.
2. If the cat has misbehaved, put the cat out.

And most notably when you can put LOOPS in. For example, if you had ten tons of sand delivered, and it had been dumped on your front garden by mistake, and you wanted it moving onto the back garden, you could write a set of commands for your household robot like this:

1. Shovel sand into the wheelbarrow until it's full.
2. Take the wheelbarrow round the back of the house.
3. Empty the wheelbarrow.
4. Take the wheelbarrow and go round to the front of the house.
5. If there's still any sand there GOTO 1
6. Put the wheelbarrow away.

That is, in effect, a computer program. If you can work out ways to command a robot to do things in a logical way, you can program a computer.

Computer programs where traditionally written with lines numbered 10,20,30,40 etc rather than 1,2,3,4 etc (so you could fit extra lines between them). Also, computer processors have only been able to obey very simple logical instructions, but they perform the commands very fast indeed, and they never tire or make human-error type mistakes. So, if you wanted to get the machine to do something complex, you would have to figure out a way of writing the task as a set of simple commands which were unambiguous. That is the art of computer programming.

Now let's see an example of computer programming