spacer
Common Sense Computing
 

Programming a Computer

Have you ever wondered how one goes about programming a computer? Even experienced computer users that know ever short cut and trick can be unsure how to create new software applications. Hi this is Jeanna Matthews and today on Common Sense Computing we are going to talk about the challenge of computer programming.

Computers are great at doing mundane, multi-step operations quickly and without error. However, they are absolutely dependent on people to tell them what do - down to the smallest, seemingly insignificant detail. They are unforgiving of any omitted instruction. Unlike people, they do not "infer from the context" or "know what you meant to say".

A good way to illustrate the challenge of programming a computer is to pick a simple task like pouring a glass of water. Then ask a partner to follow your instructions for accomplishing this task exactly and literally. For example, if you say "pour water", your partner may dump out all the water or they might refuse to pour the water unless you specify precisely how far above the glass or the exact angle at which to tip the pitcher. If your partner does a good job of "acting like a computer", you will likely be frustrated with trying to explain the smallest details of tasks you take for granted. You may also find yourself amused at just how wrong things can go. Of course, you might also find yourself a bit wet.

Computer programmers must also prepare for every possible contingency. For example, they have to write instructions for if there is no water in the pitcher, for if there is a lid on the pitcher or not, for every possible style of class in the kitchen, etc. If the computer encounters a condition that the programmer did not prepare for, then the program will crash. I'm sure you have faced the dreaded "system had encountered an unexpected error" message a time or two yourself.

Computers are also very picky about the way you express your instructions. Computer programs are usually written in small, highly structured variants of English. There is no colorful language or ambiguous phrases. Common lines in computer programs are "if this then that" or "while that then this".

Special programs called compilers take the human readable text of the instructions and translate them into binary code or a special sequence of 0's and 1's that can be read directly by the computer hardware.

Once you have the compiler executing your instructions, the really interesting part of computer programming is actually just beginning. Because inevitably, the programmer has missed some detail that causes the final result to be incorrect. The term "debugging" was coined to mean finding any such errors and fixing them. Debugging is the process of resolving the discrepancies between what you really asked the computer to do and what you meant to ask the computer to do.

So computers may be amazing but they are not the "genius machines" that are often portrayed on TV or in the movies. Without us, they wouldn't have a clue what to do and they certainly have no common sense.

For Common Sense Computing, this is Jeanna Matthews.

Copyright (c) 2005 - Jeanna Matthews


  Common Sense Computing
PO Box 6356 · Massena, NY 13662
comments@commonsensecomputing.org