AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Debug together

Week 15 · Unit 6: Be a designer · 3 lessons
3

Debug a whole project

Computing 2: Unit 6, pp. 80–91
GoalCheck a project with two characters one script at a time and fix its bugs.
New words
project · a bigger program that you plan and makescript · the blocks of one charactertest · to run a program to see if it works
Explanation

A project can have more than one character. Each character has its own script. Check one script at a time. Compare it with its algorithm. Is the start block the right one? Are the blocks and numbers right? Fix one bug, then run the whole project again. Keep testing until you cannot find any more bugs.

Frog3start ongreen flagmoverightendDuckQuack!1start onbumpsaygrowend
Worked examples
Frog3DuckQuack!1
The algorithm for the duck says: start on bump, say “Quack!”, grow 1, end. But the duck’s script starts on the green flag. The duck quacks at the beginning and not when the frog bumps it. The start block is the bug.
After the fix, the duck starts on bump. The frog moves right until it bumps the duck. Now the duck says Quack! and grows. The team runs the project again to test it.
To check a route, count the squares. The rabbit goes right 2, then down 3, then right 1. It moves 2 + 3 + 1 = 6 squares.
Class activity

Project debug in pairs: each partner writes algorithms for two characters on paper. Character 1 starts on the flag and walks to a toy on a floor map. Character 2 starts on bump, says something and hops. Each partner draws the block cards for the project but hides one mistake in one of the scripts. Swap. Compare each script with its algorithm and find the mistake. Fix it and “run” the project with your bodies to test it.

Practice
1
The algorithm says the fish starts on bump. Which block is the bug and what must it be?
Cat2Fish1
2
The algorithm for the frog says: right 2, up 2, right 2. Find the bug in the program. How many squares should the frog move in all?
212
3
A tester runs a project and the frog moves too far. What should the tester do next?
4
Why do we run the project again after a fix?