2
Debug together
Computing 2: Unit 6, pp. 80–91
GoalExplain why it helps to debug with a partner and how to be a good partner.
New words
partner · a person you work withtest · to run a program to see if it workskind · friendly and helpful
Explanation
A partner can spot what you miss. Partners can find bugs faster. One partner reads the algorithm aloud. The other partner points to each block. Partners can also share what they know. We are kind: we say “I think this block is different”, not “you are wrong”.
Worked examples
Farida and Ravi debug together. The algorithm says: start on flag, right 5, hop 2, left 5, say “Bye!”, end. The program has two bugs. Farida finds one and Ravi finds the other.
| Partner | Bug found | Fix |
|---|---|---|
| Farida | step 3: hop 3 | hop 2 |
| Ravi | step 4: left 4 | left 5 |
The fixed program. They run it to test it. The character goes right 5, hops 2, comes back left 5 and says Bye!.
Class activity
Debug in threes: sit in groups of three. One child reads an algorithm aloud. The second child lays out block cards that have two mistakes. The third child is the timekeeper and counts claps until both bugs are found. Then swap jobs with a new algorithm. Next, try to find the bugs of a new program alone and count again. Was it quicker with partners? Why?
Practice
1
Give two reasons why debugging with a partner is a good idea.
Any two, for example you find bugs faster, you find more of them, and you can share ideas and learn from each other.
2
The algorithm says: start on green flag, right 3, up 2, say “Yes!”, end. Find the bug in the program.
Step 3. The program has up 3, but the algorithm says up 2.
3
Which sentence is kinder? A: “You made a mistake again.” B: “I think step 3 is different from the algorithm. Shall we check?”
B. It is friendly, and it helps the partners to check together.
4
The algorithm has 5 steps. Farida finds a bug at step 2 and Ravi finds a bug at step 5. How many bugs did they find together?
| Step | Bug? |
|---|---|
| 1 | |
| 2 | Farida found one |
| 3 | |
| 4 | |
| 5 | Ravi found one |
2 bugs.