Home›Lesson Plans›Computer Science›Programming · Grade 7

Debugging

Seventh graders learn to debug — find and fix errors in code. Good debugging is detective work: notice the problem, read the error, locate it, change one thing, and re-test. They order the steps, then debug a program.

Grade 7Debugging50 minutes1 class periodCSTA / ISTEExplicit teaching4 StandardsCSTA
Start the Lesson
Assign or share this lesson

Copy link works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment.

Lesson at a Glance

Everything you need before the bell rings

Learning Objectives

Students will be able to…

  • ✓Find a bug.
  • ✓Read error messages.
  • ✓Change one thing.
  • ✓Re-test.
Essential Question

What do you do when your code doesn’t work?

0
Lesson Phases
0
Vocabulary Terms
0
Standards Aligned
0
Interactive Task
Put in Order · Interactive

Order the Debugging Steps

Project this and have students put the debugging steps in order.

🐛 Put the debugging steps in orderTry it
Tap the first step when code breaks!
The Lesson · Explicit teaching

50 minutes, five moves

Tap any phase to open the teacher moves and student actions.

1

Hook — It Broke!

5 min

Your program crashes — what’s your very first move?

👩‍🏫 Teacher Moves

  • Pose the question.
  • Share ideas.
  • Set the goal.

🎒 Student Actions

  • Think.
  • Share.
  • Get ready.
2

Use — Debugging

12 min

Students learn.

👩‍🏫 Teacher Moves

  • Send students to Order the Debugging Steps.
  • Order the steps.
  • Note change ONE thing.

🎒 Student Actions

  • Order.
  • Say.
  • Note it.
3

Modify — Debug It

13 min

Students practice.

👩‍🏫 Teacher Moves

  • Read an error message.
  • Find the line.
  • Guess the fix.

🎒 Student Actions

  • Read.
  • Find.
  • Guess.
4

Create — Create

15 min

Students apply.

👩‍🏫 Teacher Moves

  • Debug a broken program.
  • Change one thing.
  • Re-test it.

🎒 Student Actions

  • Debug.
  • Change.
  • Re-test.
5

Reflect — Reflect

5 min

Students close.

👩‍🏫 Teacher Moves

  • What’s the first step?
  • Why change one thing at a time?
  • Complete the exit ticket.

🎒 Student Actions

  • Say it.
  • Say it.
  • Complete the exit ticket.
Standards Alignment

Built to the standards you report on

Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students.

CSTA
2-AP-17

Systematically test and debug programs.

CSTA
2-AP-13

Give attribution and iterate on code.

CSTA
2-AP-19

Document programs to aid debugging.

ISTE
5c

Troubleshoot computational problems.

Differentiation

One lesson, every learner

Multilingual Learners

ELL / EMERGING READERS
  • Debugging-step cards.
  • Frame: "first I notice, then ___."
  • Debug a tiny program.

Support & Access

IEP / 504
  • Use 3 core steps.
  • Fix one small bug.
  • Use a checklist.

Stretch & Extend

GIFTED / EARLY FINISHERS
  • Debug a logic error.
  • Use print statements.
  • Debug a partner’s code.
Materials

What to gather

  • 📽️Screen / board
  • 🐛Debug-step cards
  • 💻Order the Debugging Steps
  • 📄Buggy code snippet
  • 📓Notebooks
  • 🎫Exit-ticket slips
Vocabulary

Key terms — hover for a quick definition

bugan error in codedebugfind and fix a bugerror messagea clue about a problemsyntax errora typo in the codelogic errorcode runs but is wrongtestcheck if code workstracefollow the codefixcorrect the problem
Evaluate

Exit Ticket

Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.

QUESTION 1
What is the first debugging step?
Notice the program isn’t working right.
QUESTION 2
Why change one thing at a time?
So you know which change fixed it.
QUESTION 3
What should you do after a fix?
Run it again to check.

Reflect: debugging.

Have students debug a broken program one step at a time. A printable buggy-code sheet is in the CS library.

Study · Flashcards

Study the key terms

Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.

🃏 DebuggingFlip
Card 1
Term
Tap to flip →
Meaning
0

Nice work!

Practice · Quiz

Check your understanding

A quick self-check with instant feedback, drawn from this lesson’s key terms.

📝 DebuggingQuiz
Score: 0
1 / 6
Question 1
0%

Nice work!

Practice · Worksheet

Printable worksheet

A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.

🖨️ DebuggingPrint
Name: ________________________
Date: ____________

Part A · Write the word that matches each meaning

Word bank: bug, debug, error message, fix, logic error, syntax error, test, trace
  1. find and fix a bug
  2. a clue about a problem
  3. correct the problem
  4. an error in code
  5. follow the code
  6. code runs but is wrong
  7. check if code works
  8. a typo in the code

Part B · Show what you learned

  1. What is the first debugging step?
  2. Why change one thing at a time?
  3. What should you do after a fix?
Answer key — Part A: 1) debug · 2) error message · 3) fix · 4) bug · 5) trace · 6) logic error · 7) test · 8) syntax error
Part B: 1) Notice the program isn’t working right. 2) So you know which change fixed it. 3) Run it again to check.