Skip to content
Computing · Secondary 3

Active learning ideas

Debugging and Fixing Program Errors

Debugging requires students to move beyond passive reading and into active problem-solving. Hands-on activities let them experience how errors disrupt execution, which builds intuition for spotting patterns in real code. Pairing and small groups create shared accountability, so students learn to articulate errors clearly and listen to alternative perspectives.

MOE Syllabus OutcomesMOE: Programming - S3
25–45 minPairs → Whole Class4 activities

Activity 01

Pair Debug Relay: Syntax Hunt

Pairs receive code with syntax errors. One partner identifies issues verbally while the other types fixes; they switch after each error. Run code to verify, then share one strategy with the class.

Explain the importance of debugging in programming.

Facilitation TipDuring Pair Debug Relay, assign roles clearly so both students contribute to tracing syntax errors step by step.

What to look forPresent students with a short Python program containing a mix of syntax, runtime, and logic errors. Ask them to identify each type of error and write down the specific line number and the nature of the error.

RememberUnderstandApplyRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 02

Numbered Heads Together45 min · Small Groups

Small Group Error Stations: Runtime Challenges

Set up stations with programs that crash at runtime. Groups predict failure points, add checks like input validation, and test. Rotate stations, compiling a group debug log.

Identify common types of errors (syntax, runtime, logic) in simple programs.

Facilitation TipFor Error Stations, rotate groups through stations in timed blocks to maintain energy and focus on one error type at a time.

What to look forProvide students with a simple program that produces an incorrect output. Ask them to describe one debugging step they would take to find the logic error and what they expect to find.

RememberUnderstandApplyRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 03

Numbered Heads Together35 min · Whole Class

Whole Class Logic Puzzle: Output Match

Display a flawed program producing wrong outputs. Class votes on logic errors, then volunteers fix live on projector. Discuss tests that reveal hidden bugs.

Apply basic debugging strategies to fix errors in their own code.

Facilitation TipIn the Logic Puzzle, require students to write test cases first before debugging to prevent jumping straight to fixes.

What to look forStudents exchange code snippets they have debugged. Each student reviews their partner's code, checking if the identified bugs are correctly fixed and if the explanation of the fix is clear. They provide one comment on the clarity of the debugging process.

RememberUnderstandApplyRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 04

Numbered Heads Together25 min · Individual

Individual Bug Journal: Personal Code Review

Students debug their own past programs, logging error types and fixes. Peer review follows, with swaps to suggest improvements.

Explain the importance of debugging in programming.

Facilitation TipHave students document each bug fix in their Bug Journal with screenshots and explanations to reinforce metacognition.

What to look forPresent students with a short Python program containing a mix of syntax, runtime, and logic errors. Ask them to identify each type of error and write down the specific line number and the nature of the error.

RememberUnderstandApplyRelationship SkillsSelf-Management
Generate Complete Lesson

A few notes on teaching this unit

Teach debugging as a structured detective process rather than a hunt-and-peck exercise. Model think-alouds to show how to isolate variables and trace logic. Avoid demonstrating perfect fixes; instead, present flawed code and let students wrestle with the uncertainty, because debugging thrives under manageable struggle. Research shows that students who verbalize their reasoning catch more errors than those who work silently.

By the end of these activities, students should confidently categorize errors, trace execution flow, and apply fixes without relying on guesswork. They will also articulate their debugging steps to peers, demonstrating both technical accuracy and clear communication. Success looks like students revising code methodically rather than making random changes.


Watch Out for These Misconceptions

  • During Pair Debug Relay, watch for students assuming all errors are typos without checking compilation messages or runtime behavior.

    Pause the relay and ask pairs to read the error message aloud, then underline the exact line in the code. Have them match the message to the error category before making any changes.

  • During Error Stations, watch for students stopping after fixing a runtime error and assuming the program works correctly.

    Require students to test with at least two different inputs, including edge cases, and record their test results in the station worksheet before moving on.

  • During Logic Puzzle, watch for students declaring the code 'fixed' after one successful output matches.

    Challenge groups to swap their corrected code with another group and test it with inputs they did not design, forcing them to verify robustness beyond their own test cases.


Methods used in this brief