2
Bugs are everywhere
Computing 1: Topic 1.4, pp. 49–59
GoalSay that people find and fix errors in lots of jobs and that code may fail from another start.
New words
check · look carefully to find a mistaketest · try something to see if it works
Explanation
People debug all the time. We check our counting. We check a puzzle. We check our drawings. Finding a mistake is a clever thing to do. A robot code that works from one start may not work from another. Check the start too!
Worked examples
Ravi counts apples: 1, 2, 3, 5, 6. There are only five apples. He skipped the number 4. He counts again: 1, 2, 3, 4, 5. Bug fixed!
Ana does a jigsaw. One piece will not fit. It is in the wrong place. She tries it somewhere else, and now the picture is right.
The code F R F works from the bottom left facing up. Someone starts the robot from the bottom right instead, and now it goes off the grid! The bug is the start square, not the code.
Class activity
Bug hunt at home or school: find three places where someone checks or fixes a mistake: a teacher checking sums, a baker tasting a cake, a mechanic fixing a bike. Draw one of them. Say what the ‘bug’ was and how it was fixed.
Practice
1
Mia says there are 6 flowers, but there are 5. What might her bug be?
She may have counted one flower twice, or skipped a number.
2
Name one place where you check your work and fix a mistake.
Any example: counting, drawing, building, a puzzle.
3
The same code works from one start but not from another. What can you check?
The start square and the way the robot faces.
4
Is it good to find a bug?
Yes. Finding a bug helps us fix the program.