Lesson Notes — Collaborative Debugging & Logic Checks
Course 1: Computer Literacy / Unit 14: Computational Thinking & Problem Solving / Lesson 3: Collaborative Debugging & Logic Checks
Lesson overview
Computers do exactly what you tell them, not what you meant. That is why even great algorithms have mistakes at first. Debugging is the process of finding and fixing those mistakes. A fresh pair of eyes is one of the best debugging tools there is.
The blind logic check
A logic check means following the steps exactly as written to see whether they work. In class you will play a game. One partner writes an algorithm for a simple task, such as folding a paper airplane. The other partner follows the steps exactly, without guessing what the writer meant.
When the steps are unclear, the follower must act on what is written. If the step says “fold the paper,” they may fold it in the wrong direction. That is not a failure of the follower. It shows where the instructions need to be more precise.
Common logic problems
- Missing step: something the writer did without thinking, such as “pick up the paper.”
- Vague words: “fold it a little” does not say how much.
- Wrong order: steps work only in a certain sequence.
- Unhandled cases: the algorithm does not say what to do if something unexpected happens.
Use test cases
A test case is a specific situation with an expected result. For an algorithm that finds the larger of two numbers, one test case is 7 and 3 with the expected answer 7. Another is 5 and 5, because the two numbers are equal. Good test cases include normal and unusual situations.
Peer review
Peer review means a classmate checks your work and gives feedback. Helpful feedback is kind, specific, and about the work, not the person. Try sentences like these:
- “I got stuck at step 4 because I did not know which hand to use.”
- “This step worked well. Maybe add what the paper should look like afterward.”
- “What should happen if the first answer is no?”
When you receive feedback, listen first. Then make a revision, an improved version, and test it again.
Check your understanding
- Why is it useful to have someone else follow your steps?
- Write two test cases for an algorithm that decides whether a student can enter a PG-13 movie alone.
- Rewrite the vague step “make the sandwich” as three precise steps.
Use this lesson’s Key Terms page to build your glossary.