Anti-Buzz: Peanut Butter Sandwich

by Andrew Emmott on May 29, 2012

in Anti-Buzz,Software

The Buzz: You wish that product X did Y


The Anti-Buzz: I wish I had a peanut butter sandwich, too.

What? This week I share with you one of the common teaching metaphors in computer programming: The peanut butter sandwich.

 All of us, myself included, are consumers of computing technology, and so have a lot of opinions about the merits and demerits of various products. And rightly so; we are the customers, and our feedback should be valued. When users consistently want a feature, or dislike a certain layout, or otherwise have sound opinions, the producers of the technologies we use would be wise to listen. All of us together have a lot of good ideas and opinions about what software should do.

But I’m not here to talk about the good ideas and opinions, I’m here to talk about the bad ones, (or, more accurately, the infeasible ones). I can’t count the number of times I’ve heard someone say they wished some product would do some thing and I would think to myself that what they wanted was either impossible, or significantly more difficult than they realized. Usually these sorts of suggestions are very subtle variations on the classic “I wish the computer would just know what I wanted” which, at the end of the day, is something we all want.

Even highly skilled programmers sometimes shake the computer by the collar and say “Oh please! You should know what I mean by now!” in response to some mistake. But there is a big disconnect between what the casual consumer wants and what the casual consumer understands. The tendency is to believe that the computer is magical or smart or both and I have said many times before that, no, computers are stupid and they are certainly not magic.

To prove it, I’m going to make a peanut butter sandwich.

Our target outcome is to have two slices of bread held together by a layer of peanut butter. Simple enough for any human to understand. When this exercise is presented to a classroom, the students are asked to write down detailed instructions on how to make such a peanut butter sandwich. Present are a loaf of unsliced bread, an unopened jar of peanut butter and a knife. In the classroom setting, the instructor takes the instructions from the class and begins trying to perform them. However at this point, the instructor ceases to be an intelligent human and becomes an aggravatingly ignorant, literal-minded robot. Here are some examples.

Instruction: Spread peanut butter on the bread. Result: Peanut butter is spread atop the loaf.
Instruction: Slice the bread with the knife. Result: The loaf is sliced “longways”.
Instruction: Put peanut butter on the slice of bread. Result: The jar of peanut butter is placed on top of the slice.
Instruction: Put the knife in the peanut butter. Result: If the jar is still unopened, the lid is ruptured by the knife.
Instruction: Open the jar of peanut butter. Result: The jar is ruptured open with the knife.
Instruction: Spread peanut butter on a slice of bread. Result: All sides of the slice are coated in peanut butter.
Instruction: Spread peanut butter on one side of a slice of bread. Result: Peanut butter is carefully spread along the outside crust.

This exercise is done for 8-year olds and it is done for college freshmen, but they all react about the same: students eventually shake the instructor by the collar and say “Oh please! You should know what I mean by now!” in response to some mistake. Depending on how fine you want to parse the exercise, you may end up requiring the class to labels all of the objects, to precisely define what a slice is, to explain the process of spreading something on something, an so on.

When it is an introductory programming class, the primary point of the lesson is to hit home that, yes, you really do have to specify everything when you program computers and would you kids please stop asking. More generally, the lesson is that people operate on a very intelligent and intuitive level, and machines don’t. Our instructions often lack detail because other people are pretty good at inferring meaning and intent from vague, incomplete instructions. For the people who make their living writing instructions for computers, they have no such luxury. Every process and subprocess must be explained, everything must be explicit.

Why is this important for you if you are never going to program computers? Because it helps to understand their limits and their behavior. It helps you understand how and why bugs exist, and perhaps why certain features are not easily available. Most important, it reaffirms that you are the smart one, you are the one in charge. The computer is only ever going to do what people tell it to.

by: at .

Share

Comments on this entry are closed.

Previous post:

Next post: