Tutorpip← About this lessonOpen the sheet →Download PDF
Ages 8+ · Coding · Step by step
Longer programs
fetchcarrydecoratecelebrate
A long program is small parts, one after another.
The big ideaA long program is built from small parts. Run each part as you build it.

How it works

A long program is built from small parts, joined end to end.

Give each part a name and one job, so each is easy to understand.

Run each part as you build it, so a bug has fewer places to hide.

Run a part, check it, then add the next. Fix one bug at a time.

Split it intopartsName each partRun and checkone partAdd the nextpart
Mina's way of building.

Example 1: Too much at once

  1. Mina snaps on all twenty blocks and presses Go without checking a single part.
  2. One step is mixed up, so Bo sets out candles but forgets the cake.
  3. Finding one bug in twenty steps takes forever.

Example 2: Cut it into parts

  1. Teo cuts the long strip into four short parts: fetch, carry, decorate and celebrate.
  2. Each part has a name and one job.
  3. A long program is just small programs joined end to end.

Example 3: Run a part, check it

  1. Mina runs part one alone, and Bo fetches the cake, so she keeps that part.
  2. Part two has a bump, but it holds only six steps, so it is quick to check and fix.
  3. Then she adds the next part.

Example 4: The order matters

  1. The program has six steps: fetch the cake, carry it to the table, put the candles on, switch the candles on, switch the room lights off and play the song.
  2. The candles must glow before the room goes dark.
  3. So switch the candles on comes just before switch the room lights off.
1fetch the cake2carry it to the table3put the candles on4switch the candles on5switch the room lights off6play the birthday song
Bo's birthday program, in order.

Words to know

part
A small piece of a long program, with a name and one job.
bug
A mix-up in a program that you can fix.
run
To make the program go, to see what it does.

Watch out

Try it

  1. Mina's program has twenty steps and she has run none of them. Will a bug be easy or hard to find?
  2. What do you do right after a part works?
  3. How many things should you change when you fix a bug?
  4. Which comes first in Bo's birthday program: carry the cake to the table or put the candles on?
  5. A long program is small programs joined end to what?
Answers: 1. Hard · 2. Check it, then add the next part · 3. One · 4. Carry the cake to the table · 5. End
Try at homePick a long job, like making breakfast or tidying a room. With a grown-up, split it into four short parts and give each part a name, then do part one and check it before you start part two.
For grown-upsDo the Mission: pick a long job like making breakfast or tidying a room, split it into four short parts together and give each a name. Do part one and check it before you start part two.
Open these notes on screenScan the code, or go to tutorpip.com.