Programs: Easy as Pie...

Section: Programs: Easy as Pie...

You are a complex computing machine. You carry out pre-programmed instructions all the time. For example, consider the process of baking a cherry pie. This is a well-known task that humans have been doing for centuries. Even if you don't know how to bake a cherry pie, you do know that recipes for such a task exist.

Such consists of an ordered sequence of steps. It's crucial to perform the steps in the prescribed order. It would not make sense to "bake for 25 minutes" before you've performed the "heat oven to 400°F" step. But, if you follow the instructions carefully, you should be able to produce a cherry pie at the end. Note that there is a clear beginning and end to this entire process. Furthermore, note that you are probably following a recipe that someone else invented and wrote down. In computer science, we would say that you are executing a program for baking a cherry pie.

Similarly, planning a task is a familiar process. You want to bake a cherry pie. First, you search for a recipe. Then you go shopping for the ingredients. Then you follow the recipe, wait for the pie to cool, and, at long last, eat a big slice! You came up with this process on your own. You didn't find it in a book. You devised your own program, and then executed it. One step in your program involved doing the actual baking, which meant following the instructions in the recipe. But, once that was accomplished, you pick up with the "wait" step of your program and continue.

So, planning a task is akin to writing a program and following a recipe is akin to executing or running a program. A program is nothing more than a sequence of instructions, written by you or by someone else.


Suzanne Menzel; menzel@cs.indiana.edu