Skip to content
6 min read

Debugging as a Thinking Skill: Unplugged Activities

Unplugged activities that teach students to isolate a fault instead of guessing, using trace tables, human robots and halving, with differentiation for mixed classes.

Debugging as a Thinking Skill: Unplugged Activities

Quick answer: Most students debug by changing something and running it again. That is guessing. The skill is isolating where the behavior first diverges from what you expected, and it can be taught entirely on paper. Trace tables, human robots and halving take about three periods and transfer to any language, including the ones your students will use after you.

Why does "just try something" become a habit?

Because it works often enough. A student changes a number, the output looks better, and the lesson learned is that fiddling pays. Then they hit a program with three interacting faults and fiddling stops working, and they conclude they are not good at this.

The alternative habit has two parts and both are teachable. The first is stating the expectation before running anything: what should the output be, exactly, for this specific input. Students who cannot answer that cannot recognize a wrong answer when they see one. The second is narrowing: finding the earliest point where reality and expectation part company.

Neither of these needs a computer. In fact, a computer gets in the way at the start, because the run button is right there and it costs nothing to press.

What is the trace table activity?

Give students a short algorithm in plain English or pseudocode, six to ten lines, with one deliberate fault. Something like: set total to zero, set count to zero, for each number in the list add it to total, add one to count, at the end divide total by count and report the average. Then a fault: the list is empty for one of the test cases.

The table has one column per variable and one row per step. Students fill it in by hand, line by line, writing the value of every variable after each step. No skipping. The row where the table goes wrong is the fault.

What this teaches, and nothing else does as well, is that a program has a state at every moment and that state is inspectable. Students who have filled in twenty trace table rows by hand understand what a debugger is showing them the first time they see one.

Expect resistance. Filling in the table is boring and slower than reading the code. Say so and do it anyway. Point out that the table found the fault in ninety seconds and reading the code had not found it in five minutes.

The ready-made version of this lesson

More in Computer Science for Middle School. Every download has a 30-day money-back guarantee.

How do you run the human robot activity without chaos?

One student is the robot. They follow written instructions literally and do nothing that is not written. The class writes instructions to get them from the door to a chair, or to draw a specific shape on the board.

Three rules keep it useful. The robot may not interpret. If the instruction says "walk forward" with no number of steps, the robot walks until told to stop, including into a wall, at walking pace, safely. The robot may not ask questions. And the class may not shout corrections; they must write a revised instruction.

Run it with a clear task and let it fail. The failure is the content. Then ask the debugging question rather than the fixing question: which instruction was the first one that did not do what you intended. Students want to jump to the last one, because that is where the visible mess is. The fault is almost always earlier.

Add a second robot for the extension. Two robots following the same instruction list produce different results if the instructions depend on unstated starting conditions, which is how students meet the idea that a bug can be conditional on state they did not think about.

How do you teach halving?

Take a twenty-step procedure with one fault. Do not trace from the top. Check the state at step ten. If it is correct, the fault is in steps eleven to twenty. If it is wrong, the fault is in one to ten. Then check the midpoint of that half.

Twenty steps takes at most five checks. Tracing from the top takes up to twenty. Write both numbers on the board, because the argument for the method is arithmetic, not opinion.

A neat unplugged version: hide a marked card in a sorted deck of thirty-two and have students find it by halving. Five guesses maximum. Students who race each other on this get the idea faster than students who are told about it.

How do you differentiate?

Approaching: four-line algorithms, two variables, and a partly completed trace table where the first two rows are done. The fault should produce a visibly absurd result, such as an average larger than every number in the list.

On level: eight to ten lines, three variables, one fault, blank table. Require them to write the earliest wrong row number as their answer, not the fix.

Above level: two faults, one of which masks the other, so fixing the first makes the output look worse. That is the most realistic thing you can hand them and it produces the best conversations. Follow it with a task where students execute a step-by-step encoding procedure and find the error in someone else's work, which is exactly the structure used in How the Internet Works when packets go astray.

Frequently asked questions

Does this work if my students have never coded?

Yes. Everything here uses plain English procedures. If anything, teaching it before the first programming lesson saves time later.

How do I stop the human robot activity becoming a performance?

Rotate the robot every four instructions and pick quietly rather than asking for volunteers. The students who volunteer are the ones who want an audience.

Should students name the bug types?

Three categories are enough: it will not run, it runs and crashes, it runs and gives the wrong answer. The third is the hard one and the one worth most of your time.

How long is the sequence?

Three periods. Trace tables need a full one on their own, and rushing them wastes the activity.

Related posts

Want a ready-to-teach curriculum?Complete, ready-to-use teaching curricula for Middle & High School — structured units, assessments, and more.

All Middle School Curricula →

Teaching High School classes?Complete, ready-to-use teaching curricula for Middle & High School — structured units, assessments, and more.

All High School Curricula →
✏
About the author
The TeachLessons Team
Curriculum Designers & Educators

The TeachLessons team is made up of experienced classroom teachers and curriculum specialists from the US, UK, and Australia. We build complete, ready-to-use teaching resources because we know what it takes to walk into a classroom prepared. Every resource is grounded in real teaching practice, standards-aligned, and designed to make lessons better from day one.

Curriculum DesignK–12 EducationStandards AlignmentClassroom PracticeLearning Design
Common Questions

FAQ about TeachLessons resources

TeachLessons provides K–12 resources. Complete Curriculum packages currently focus on Middle School and High School, while the blog also supports Elementary teachers.

Each package includes lesson plans, worksheets, assessments, rubrics, and teacher notes as print-ready PDFs.

Yes. Resources align with relevant US standards such as Common Core, NGSS, and the NCSS C3 Framework.

Yes. Complete Curriculum packages currently focus on Middle and High School, while our blog supports Elementary teachers with lesson ideas, classroom strategies, cross-curricular activities, free downloads, and Teach-Life-Balance support.

  • Blog articles with practical lesson ideas
  • Free resources via the newsletter
  • Teach-Life-Balance for teachers at every level

The Teach-Life-Balance course is a time-saving programme for Elementary, Middle, and High School teachers. It helps with lesson planning, marking, admin, routines, boundaries, and workload management.

It includes a teacher planner, guides, templates, and practical strategies. Available at teachlessons.us/products/teach-life-balance.

After purchase you receive an instant email with your download link. Files are also stored in your customer account under Orders. Materials are print-ready PDFs for class, projection, or digital use.

Resources are licensed for personal classroom use. You may use them in your own classes. Sharing digital files or uploading them online is not permitted under a single-user licence. School licences are available on request.

Yes. Although primarily aligned to US standards, the lesson structures and subject content work well for UK and Australian classrooms with minor adaptation. The store supports GBP and AUD currency.

Keep reading

You might also like

Discussion

Comments

No comments yet — be the first to share your thoughts!

Leave a comment

Comments are reviewed before being published.

Also join the newsletter?
Get weekly lesson ideas and a free resource pack.

Please fill in all required fields and confirm your consent.

* Required. Email will not be published. Privacy Policy.

✅

Thanks for your comment!

Your comment is being reviewed and will appear here shortly.

Free resource inside

Lesson ideas straight to your inbox.

Join thousands of teachers. Sign up and get a free starter resource pack plus weekly lesson ideas — no fluff, just things that work in real classrooms.

No spam, ever
Unsubscribe any time
GDPR & COPPA compliant

Please fill in all required fields and confirm your consent.

💌

Almost there, !

Check your inbox and click the confirmation link to receive your free pack.

1
Check your inboxA confirmation email from teachlessons.us is on its way.
2
Click the linkConfirm your email to activate your subscription.
3
Receive your free packYour starter resource pack arrives right after confirmation.
No email yet?Check your spam or junk folder and mark us as “Not Spam”. Sender: teachlessons.us