Debug the Recipe
Overview
Every programmer spends more time debugging — finding and fixing errors — than writing new code. It's not a side activity; it's the main activity. This practice session builds the debugging instinct using something children already understand: recipes. You'll give your child scrambled, incomplete, and nonsensical recipes, and they'll find the bugs, name them, and fix them. By the end, they'll know that "it doesn't work" is never the end of the story — it's the beginning of detective work.
Setup
Prepare the buggy recipes (10 minutes, in advance):
Write out 3-4 simple recipes on separate sheets of paper — but with deliberate errors. Here are ready-to-use examples:
Buggy Recipe 1: Peanut Butter & Jelly Sandwich (wrong order)
- Spread peanut butter on one slice of bread
- Put the two slices together
- Get out the bread, peanut butter, and jelly
- Spread jelly on the other slice
- Cut the sandwich in half
- Get a plate and a butter knife
Buggy Recipe 2: A Bowl of Cereal (missing steps)
- Get a bowl
- Pour milk
- Eat with a spoon
(Missing: get the cereal, pour the cereal, get a spoon)
Buggy Recipe 3: Brushing Your Teeth (wrong actions)
- Pick up your toothbrush
- Put shampoo on the toothbrush
- Brush your hair back and forth
- Spit out the water
- Rinse the toothbrush
- Smile at yourself in the oven
Buggy Recipe 4: Making Toast (all three bug types combined)
- Eat the toast
- Put bread in the toaster
- Get out the bread and butter
- Push the toaster handle down
- Spread butter with your fingers
- Wait for the toast to pop up
Adjust these to match your child's reading level. For younger children (5-6), read aloud. For older children (7-8), let them read independently.
Instructions
Part 1: Bug Types (5 minutes)
Before diving into the recipes, teach the vocabulary:
"In computer programming, a mistake in the instructions is called a BUG. There are different kinds of bugs. Today we're going to learn three:"
- Order Bug — "The steps are in the wrong order. Like putting on your shoes before your socks."
- Missing Step Bug — "A step is missing. Like a recipe that says 'put the cake in the oven' but never says to turn the oven on."
- Wrong Action Bug — "The step says to do the wrong thing. Like 'stir the soup with a pillow' instead of a spoon."
"Your job today is to be a debugger — a bug hunter. Find the bugs, name what kind they are, and fix them."
Part 2: Debug the Recipes (15 minutes)
Hand your child the first buggy recipe and the red pencil.
"Read through this recipe. Something is wrong. Find the bugs, circle them with the red pencil, and tell me what kind of bug each one is."
For each recipe:
- Let them read it through once without commenting
- Ask: "Does this recipe work? What would happen if you followed it exactly?"
- Let them identify and circle the bugs
- For each bug: "What kind of bug is this? Order, missing, or wrong action?"
- Ask them to write (or dictate) the corrected version
Work through all 3-4 recipes. The difficulty progresses — Recipe 1 has one bug type, Recipe 4 has all three.
Part 3: Make the Fixed Recipe (10 minutes, optional)
Choose one of the corrected recipes that you can actually make (the PB&J is ideal). Follow your child's corrected instructions step by step.
"Let's test your debugged recipe. I'll follow your corrected instructions exactly. If we got the bugs out, it should work perfectly."
If it works — celebrate. They just wrote working code and it compiled on the first run.
If there's still a bug (a missed step, an unclear instruction) — even better. "We found another bug during testing! That's totally normal. Let's fix it and try again."
What to Watch For
- Bug identification speed: Does your child catch errors on the first read-through, or does it take a few passes? Both are fine — the skill develops with practice.
- Bug classification: Can they name the type of bug? This isn't just vocabulary — it's analytical thinking. Knowing that something is a "wrong order" problem tells you the fix (rearrange) is different from a "missing step" problem (add something).
- Critical reading: Do they start reading ALL instructions more carefully after this activity? Recipes, game rules, LEGO instructions — debugging transfers everywhere.
- Enjoyment of error-finding: Some children love this. It feels like being a detective. If your child lights up when finding bugs, lean into it — this is the mindset that makes great programmers.
Variations
Write your own buggy recipe: Challenge your child to write a recipe (for getting dressed, feeding the dog, making a snack) with deliberate bugs, then give it to you to debug. Writing bugs intentionally requires understanding what correct looks like.
Physical debugging: Give verbal instructions for a simple task (walking to the front door, setting the table) with deliberate errors. Your child has to stop you when they hear a bug. "WAIT — that's an order bug! You can't open the door before you walk to it!"
Increasing difficulty: For ages 7-8, add a fourth bug type: the logic bug — the instructions are technically in order and complete, but they produce the wrong result. Example: a recipe for lemonade that says "add 2 cups of salt" instead of sugar. Everything is correct except the core logic.
Peer debugging: If homeschooling with other children or siblings, have each child write a set of instructions and swap with a partner for debugging. This mirrors real-world code review.
Reflection Prompts
- "Which kind of bug was hardest to find? Why?"
- "Have you ever tried to follow instructions that had a bug in them? What happened?"
- "Why do you think programmers spend so much time looking for bugs instead of just writing new code?"
- "If you were building a robot, which kind of bug would be the most dangerous — wrong order, missing step, or wrong action?"