Recipes are not Programs

  • programming is often introduced to beginners (and end-users in End-User Programming) as "creating a recipe for something" - what is hard about programming is that computers can't figure stuff out on their own - you have to specify every single step, every possible failure mode, and what to do then - which makes the metaphor break apart because if you give someone a recipe for a cake, you don't have to specify what to do if they have no sugar in the house

Instructions never completely specify what to do. A recipe says "lay the slices of eggplant on paper towels and sprinkle lightly with salt"; it does not say how you pick up each slice and where to position it on the paper towel; or what to do if you drop one; or whether you scatter the salt from a shaker or from between your fingers.

This is obvious, but bears emphasizing due to a potential rationalist misunderstanding. Often programming is introduced as "giving the computer instructions," and programs are likened to recipes. This is probably helpful for novices, but potentially misleading in that a program does have to specify what will be done in complete detail. Then the computer does exactly and only what the program says.

This understanding of program execution is then sometimes read back onto human activity. One rationalist theory of action is that you write "plans" for yourself, where "plan" means a program, and then execute them. For many different reasons, this can't work; one is the impossibility of foreseeing all the details of how irregular slices of eggplant will flex or slip, and so exactly how you will have to grip them. Reality is complicated, so you often have to wait to figure out how to cross a river until you get there.

Instructed activity