2011-11-14

The Peanut Butter Protocol

Here's something that pops up in math/computer science that I honestly just HATE so much (I got sufficiently riled up while describing it to my girlfriend tonight that I thought it would make a perfect blog post). On the question of "How do you introduce programming concepts to students for the very first time (possibly children)?", a very common answer is "Ask them to give the steps for making a peanut-butter and jelly sandwich!" (or something very similar). For example, whenever this comes up on Slashdot, the responses are predominantly along the lines of "love this... lovely... hilarious" (link). But I'm completely contrarian about it.

Of course, the point is basically a "gotcha" exercise: the students say "scoop out the peanut butter" and you go "what!? look, now I'm batting the jar-top with my hand, because you didn't tell me to pick up the knife, and you didn't tell me to screw off the jar-top," etc., etc. etc. If I was a student, and this my first encounter with computer programming, then it would instantaneously sour me on the whole subject, maybe permanently: the task is inherently ambiguous, impossible, unfair, and a trick to apparently set up the respondents for ridicule and embarrassment.

The primary problem (in my opinion) is that's very much not how mathematics or computer programming work. What we must do in practice is to start with an agreed-upon set of atomic operations, which we may call "definitions" or "axioms" or a "function library", depending on the context. Of course, the power of your elementary pieces is variable, depending on the abstraction level at which you're operating. But the real work of programming or proof-building is in how we connect these well-known (and well-defined) basic building blocks in a way that constructs something new, useful, and interesting.

So the "peanut butter sandwich" task is thoroughly and painfully unfair without presenting the allowed operations up front: Am I supposed to say "pick up the knife" or "wrap your fingers around the knife, apply opposing force with thumb, lift forearm" or "bend index finger 5 degrees, now 10 degrees, now 15 degrees..." (it's sort of irrelevant, because without well-defined operations, the presenter can always pick some lower-granularity abstraction and create a "gotcha!" moment). The demonstration does manage to get across the idea that you will be "working with small operations", and also that "unexpected bugs will happen" -- but in my mind, neither of those are essential or even very important. The essence of any creative work is in taking well-known basic tools and building something greater from them than previously existed, and that's something that I think almost anyone can understand and justifiably take satisfaction from.

(P.S. a counter-offer: Rudimentary programming like LOGO. Write on the board 3 allowed operations: (1) turn left, (2) turn right, and (3) step forward. Now direct me how to get from one corner of the room, around some desks, and out the door -- possibly listing the whole instruction set in advance of testing it. Something like that.)

1 comment:

  1. Again, we agree. The PBS approach is the most inane thing one could come up with. I would be bored to death as a kid had someone "introduced" me to computers that way. It was BASIC and LOGO for quite a while, and the almost instant gratification you got by typing a few lines and running them. I sometimes think any 80s-vintage BASIC microcomputer with graphics support is still the fastest way to draw a circle, even today, when you compare the "boot" and typing time on the former to the time it takes to start up paint and get a circle drawn by mousing around even on modern hardware.

    ReplyDelete