Tuesday, October 26, 2010

October 26, 2010 (Programmers)

What do you do when a program won't do what you expect it to?

This year's group of Programmer wanna-be's found out when they tried to program ME to make a peanut butter sandwich.  Their objective was to tell me the exact steps I needed to take in order to make a sandwich.  Sounds simple and I did exactly what they said.  When they said "Open the bag of bread," I ripped a hole in the side of the bag.  When they said "Flip the bread," I did...so the peanut butter was on the bottom.

The point of the activity was to demonstrate how much we take for granted when we try to describe how to do something. We understand what we mean when we give a command - whether to another person or to a computer - so it often takes us by surprise when things don't go as we expected.  As I told the kids, computers are really very stupid.  They don't know anything or understand anything other than what we tell them. Sometimes we need to explain the extra steps ("Take off the twist tie.  Open the front of the bag.").  Sometimes we need to be more explicit with our language (there is a difference between "flip" and "rotate").  The great news is that once we understand what our expectations are, it becomes easy to describe those intermediate steps.

The kids did a FANTASTIC job.  Thinking back on it, I realize there were some times when I could have been more obtuse or contrary, but not many.  They learned quickly from my "mistakes" and fixed their "program" with very few hints.

After they were done, everyone wanted a peanut butter sandwich to celebrate, although nobody wanted the first poor, mangled sandwich.

Everyone wanted to know, "why not peanut butter and JELLY?" I thought we did well enough with just one sticky substance to deal with.