Programming a jam sandwich

posted in: Games, Group Challenge, Skill Based | 0

Duration:

15 minutes

You’ll need:

  • Bread
  • Jam
  • Knife
  • Plate

Focus:

This activity will introduce the girls to several computer science concepts. They will learn why thoroughness is so important for programming and be introduced to the, often strange, results of literalism. The overarching theme being introduced is that computers do what they are told and nothing more. The ability to read between the lines and determine what was meant rather than what was said is not a skill computers have. This activity also introduces the concept of debugging through iterative attempts to program a computer to make a jam sandwich.

1.

Start by asking the girls to call out instructions for making a jam sandwich. Write them down on a big piece of paper.

2.

Now tell the group that you are a computer and that you are going to follow their instructions to try and make a jam sandwich.

3.

Now make the sandwich, interpreting the instructions in the most literal way. For example, if the girl’s instructions are:

  • take a slice of bread
  • put jam on the slice
  • take a second slice of bread
  • Put jam on that slice
  • Press the slices of bread together

You would take a slice of bread, put the jar of jam on top of the slice, take a second slice of bread, move the jar of jam that slice, then pick up both slices of bread and push them together; no one told you to open the jar or use a knife to spread the jam..

If a step in the students instructions seems impossible or requires additional explanation (e.g. Open the jar of peanut butter or instructions to insert the knife into the jar of peanut butter before the jar has been opened.) proceed by attempting to complete the instruction in a ridiculous manner (e.g. turning the jar upside down and shaking, or attempting to stick the knife through the side of the jar).

4.

Explain to the girls that the sandwich doesn’t seem quite right because you were missing some information, and computers can’t think for themselves. Then ask for a new set of instructions.

5.

The instructions you are ultimately aiming for are something like this:

  • Take a slice of bread
  • Open the jar of jam by twisting the lid counter clockwise
  • Pick up a knife by the handle
  • Insert the knife into the jar and use it to scoop some jam
  • Withdraw the knife from the jar and run it across the slice of bread
  • Take a second slice of bread
  • Repeat steps 2-5 with the second slice of bread
  • Press the two slices of bread together so that the the two jammy sides meet

6.

Explain to the group that what you have done is very similar to what computer programmers. They write instructions that tell our devices what to do in different scenarios. They have to be very specific, because computers can’t think for themselves, and they have to try the process again and again to make it work just right.

Jobs in computer programming are very important, especially because everything we do is on computers. If they want to try a bit more, they might find the free Scratch website fun outside of the session.

Adaptations

  • If the group’s attention span is a bit shorter, or you are short on time, you can skip the first step and just ask girls to call out instructions for the start.
  • For older girls, you could let one of the group be the sandwich maker – you may have to steer them if they complete actions outside of the ones they are given.
Print Friendly, PDF & Email

Leave a Reply