Skip to the content
Peabody TeachFor teachers and grown-ups

🐛 Find the Bug in the Recipe v0.1.0

Three sets of steps (a fruit cup, getting ready for school and a paper boat) each have one planted mistake. The class reads them like a computer would, finds the bug, and fixes it.

  • For: K to 3rd
  • Time: about 25 minutes
  • The question: How do you find the mistake in a set of steps?
  • CSTA (2017): 1A-AP-14

You will need

  • The printable's three step lists
  • Pencils
  • Optional: the real things, such as a paper cup, a sheet of paper and a pretend fruit

The lesson, step by step

  1. Say what a bug is

    A bug is a mistake in a set of steps. People who write steps for computers call finding and fixing them debugging. Say that even the best programmers have bugs, and the trick is finding them, not never making them.

  2. Do the first list together

    Read the fruit cup steps aloud, one at a time, pretending to be a computer that does exactly what it reads. Stop where it stops making sense. Ask the class: "Which step is the bug?" Mark it with a star.

  3. Name the kind of bug

    Show the three kinds, using what the class just found: a step in the wrong place (order), a step that is missing, and a step that repeats the wrong number of times. Write the three on the board, with a small picture each.

  4. Hunt in pairs

    Pairs work on the other two lists. For each one they act the steps out or read them slowly, find the bug, say what kind it is, and write the fix on the line. A step list may be acted with real things if you have them.

  5. Check the fix

    A fix is only a fix if it works. Pairs read their corrected steps aloud, or act them out, from top to bottom. If another bug is hiding, they find it too.

  6. Make a bug

    Pairs write a four-step set of steps for something they know how to do, then plant one bug and swap with another pair. Finding a friend's bug is the best part of the lesson.

Questions to ask while they work

  • What happens if we do exactly what it says?
  • Where does it stop making sense?
  • Is a step missing, in the wrong place, or repeated too many times?
  • How do you know your fix works?

If it goes fast

  • Debug the steps for a game the class plays at recess.
  • Find a bug that only shows up sometimes: "if it is sunny, put on a coat".
  • Read each list backwards, then say why the order matters.

The printable

Give each pair the sheet. The bugs are: 1 an order mistake, 2 a missing step, 3 a repeat with the wrong number.

◂ If-Then Cards · All ten lessons · The Stair Robot: Loops with a Count ▸

Nothing on this page is sent to us. The printable has a blank name line and no child's details. No sign-in, no ads.