The big ideaBuild a big program from small parts. Make each work, then join them.
How it works
A big program is built from small parts, the way a jigsaw puzzle is built a piece at a time.
Make each part work alone first, and then join them, one at a time, checking after every join.
Give every box a clear name. Two boxes with the same name clash and share one number.
Reuse a part instead of copying it. A custom block is written once and used anywhere, so changing it once changes every use.
The three parts of Teo and Mina's game.
Example 1: Split it up
Teo and Mina want a game with ships, rocks, hearts, shields, bosses and ten levels.
That is too big to build at once, so they split it into three parts: the ship, the rocks and the hearts.
Mina builds the ship and Teo builds the rocks, and each part gets its own screen.
Example 2: A name clash
When they join the parts, the ship zooms about while the rocks creep.
Both parts had a box called speed, so they shared one number.
The mix-up to fix: rename them ship speed and rock speed.
Example 3: Reuse a part
Teo copied his rock code five times, so changing the size needs five fixes.
A custom block called make a rock is written once.
Change the block once, and every rock changes.
Example 4: Join and check
Join the ship and the rocks, and check that it works.
Then join the hearts, and check again.
A bug found after one join is easy to find, because only one thing changed.
Words to know
part
A small piece of a big program that works alone.
custom block
A block you write once and use anywhere.
clear name
A name that says what the box holds, like ship speed.
Watch out
Do not write the whole game in one go. A giant piece is hard to fix.
Join the parts one at a time and check, instead of joining everything and hoping.
Two boxes with one name clash. Give each its own clear name.
Copying code five times means five fixes. Make one block instead.
Try it
Should a giant game be built in one big piece or in small parts?
Both the ship and the rocks have a box called speed. What goes wrong?
Which names fix it: speed and speed, or ship speed and rock speed?
Why use a custom block instead of copying code five times?
Which part shows how many lives are left?
Answers: 1. In small parts · 2. They share one number · 3. ship speed and rock speed · 4. Changing it once changes every use · 5. The hearts
Try at homeChoose a big job at home, like tidying a room or planning a picnic. With a grown-up, write it as three or four small parts. Give each part a clear name, and do them one at a time. Notice which part took longest.
For grown-upsTry the Mission on a real job at home, like tidying a room or planning a picnic: write it as three or four small parts, give each a clear name, do them one at a time, and notice which took longest.
Open these notes on screenScan the code, or go to tutorpip.com.