DEV Community

Discussion on: What are your favorite analogies to explain programming?

Collapse
 
dansherpa profile image
dansherpa

I taught 2nd graders the concept of programming by having them design and build a peanut butter and jelly sandwich.

Requirements: bread, pb, jelly, knife, plate, etc (have them on hand, but hidden, then have the class list what is needed)
Program: have one group list the steps to build it
Test: have another group follow the "program" literally

So, in my case, the first step in the program was to spread the peanut butter on the bread. We immediately found the first bug. The bread was still in a bag - it had to be opened and taken out and put in the plate. The peanut butter had was unopened, etc. Go back and iterate on the program until they get it right.

It gives them a great feel for how detailed a program needs to be, and that the computer only follows the instructions you give it.