All posts

A recipe is a program: everyday algorithms for children

An egg on the left, an arrow, a mixing bowl with a wooden spoon in the middle, another arrow, and a plate with a cookie on the right, read from left to right like steps.

"First the yoghurt, then the fruit, then the honey on top." Every time your child follows a recipe, they're following an algorithm: a list of clear steps, in order, that turns something at the start into a result at the end.

That's exactly what a computer program is. You don't need a screen to teach the idea. The kitchen is one of the best places to explore it, because the steps are real, the results are visible and the mistakes are often funny (and edible).

A recipe has the same parts as a program

Before cooking, read the recipe together and name its parts:

In a recipe In a program
Ingredients Input: what you start with
Steps, numbered in order Instructions, run one after another
"Stir 10 times" A loop: repeat a step
"If it's too thick, add a spoon of milk" A condition: do something only if...
The finished dish Output: the result

You don't need to use the words "input" or "loop" with young children. "What do we need?", "What do we do first?" and "What should we get at the end?" are enough.

Choose something simple and safe, where the adult handles anything hot or sharp: a fruit and yoghurt cup, a sandwich, a smoothie or a no-bake snack.

Does the order matter?

A great thinking question is: which steps can swap places, and which can't?

Take a yoghurt cup as an example:

  1. Put yoghurt in the cup.
  2. Add chopped fruit.
  3. Drizzle honey on top.
  4. Eat.

Can steps 2 and 3 swap? Probably yes, it just looks a bit different. Can steps 1 and 4 swap? Definitely not! Talk through each pair: "What would happen if we did this one first?"

Children discover that some steps are independent (the order doesn't change the result much) and some depend on others (one has to happen before the other). That's one of the key ideas in planning and in programming.

Play "robot parent"

This game is a favourite. You become a robot who follows instructions exactly as they're said, nothing more.

Your child gives instructions for making a sandwich. If they say "put the jam on the bread", you put the closed jar on top of the bread. If they say "pick up the knife" without saying which hand, you look confused.

  • Keep it playful, and stop before it becomes frustrating.
  • After a few laughs, help your child make the instructions more precise: "Open the jar. Use the spoon to take some jam. Spread it on one slice."
  • Swap roles, and let your child be the robot.

The lesson is that computers, like robots, only do what they're told. Clear, precise steps matter.

Add loops and conditions

Once your child is comfortable with steps in order, look for two special kinds of steps in recipes:

  • Loops (repeats): "Stir 10 times." "Add one spoon at a time until the bowl is full." Count together as you repeat the step.
  • Conditions (if...): "If the banana is too big, cut it in half." "If the mixture is dry, add a little water." Ask: "Do we need to do that step this time?"

Spotting "repeat" and "if" in everyday instructions is a gentle introduction to the building blocks of all programs.

Write your own recipe

Finally, invite your child to write (or draw) a recipe for someone else:

  • Draw each step in its own box, with arrows between boxes.
  • Number the steps.
  • Test the recipe: an adult follows it exactly, and you see whether the result is right.
  • If something goes wrong, find the step that needs fixing. That's what programmers call debugging.

Children who can't write yet can draw pictures for each step and explain them aloud.

In Dologi, "Drive the car" puzzles work the same way: children put commands in order to drive a car through a maze to the stars, and if one command is in the wrong place, the car ends up somewhere else.

In short

  • A recipe is an algorithm: ingredients in, ordered steps, a dish out.
  • Ask which steps can swap places and which must come first.
  • Play "robot parent" to show why instructions need to be precise.
  • Look for repeats and "if" steps, then let your child write and test their own recipe.

Read more: Breaking big jobs into small steps: step-by-step thinking for children