What is Programming_00003
What is Programming_00003
In other
words, it was the act of writing something in advance, or ahead-of-time. Of course, 2000 years ago this
was not used in reference to writing instructions for computers, but it still accurately describes what we
mean when we say “computer programming” or just “programming.” When we “program” a computer we
are writing instructions that we want the computer to follow, before it begins the process of following
those instructions.
The process of a human writing computer code is analogous to one human giving instructions for another
human to follow. A classic example of this comes to play in food-preparation recipes. A recipe for a meal
can be boiled-down to a sequence of instructions that a human must follow very carefully, and in the
correct order, in order to arrive at the desired goal: a delicious meal. As a rudimentary example, let’s use
the “recipe” for making a peanut butter and jelly sandwich (yes, this still counts as a “delicious meal” :).
Imagine you were teaching your friend, Ryan, to make a Pb&J who had never made one before. If you had
to write down the steps, you’d probably tell him something such as:
• Get out two slices of bread, a jar of peanut-butter, and a jar of jelly.
• Place each piece of bread next to each-other on a plate.
• Get a knife, and scoop out a few ounces of peanut butter.
• Spread the peanut butter evenly on one of the open bread faces.
• Get a separate knife, and scoop out a few ounces of jelly.
• On the other slice of bread, spread evenly.
• Fold the two pieces of bread together, with the peanut butter and jelly sides facing each other.
• Enjoy!
In this case, you essentially just “programmed,” except instead of programming a computer, you
programmed Ryan. You wrote down the instructions for creating a Pb&J in advance, and then gave these
instructions to your programe. Writing computer code, or “programming” a computer, can be thought of in
a similar way to giving instructions to another human being. There are obviously some differences,
because a computer is a very different type of entity.
• Computers are VERY good at following instructions. They do EXACTLY what you tell them to do (not
always the case with us humans)
• However, computers are not CREATIVE and don’t have INTUITION. This means that you have to be
VERY speci�c when telling a computer what to do.
As you might expect, computers aren’t really designed to create Pb&J sandwiches. However if we were to
attempt to communicate to a computer how to make one, we would have to be much more speci�c that
we were to Ryan. This is because Ryan can use his intuition, creativity, context, memory, etc to extrapolate
some of the things we say. For example, when we said:
“Get out two slices of bread, a jar of peanut-butter, and a jar of jelly”
Ryan already knows what peanut-butter is, what jelly is, what bread is, and where these ingredients are
stored in the kitchen. He also uses his intuition to �gure out what we mean by “Get out…”. He can infer that
this probably means pull each out of the cabinet / fridge and place them on the counter top. If we were to
program the computer (say, inside of some kind of robot) to make Pb&J’s, we need to have instructions
with much greater detail. For example