# 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… **Computer Science** | **Grade 7** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g7-cs-debugging.html* 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. **Copy link** works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment. ## 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. What do you do when your code doesn’t work? ## Order the Debugging Steps Project this and have students put the debugging steps in order. ## 50 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — It Broke! 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. ### Use — Debugging Students learn. #### 👩‍🏫 Teacher Moves - Send students to Order the Debugging Steps. - Order the steps. - Note change ONE thing. #### 🎒 Student Actions - Order. - Say. - Note it. ### Modify — Debug It Students practice. #### 👩‍🏫 Teacher Moves - Read an error message. - Find the line. - Guess the fix. #### 🎒 Student Actions - Read. - Find. - Guess. ### Create — Create Students apply. #### 👩‍🏫 Teacher Moves - Debug a broken program. - Change one thing. - Re-test it. #### 🎒 Student Actions - Debug. - Change. - Re-test. ### Reflect — Reflect 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. ## Built to the standards you report on Aligned to the CSTA K-12 Computer Science Standards and the ISTE Standards for Students. Systematically test and debug programs. Give attribution and iterate on code. Document programs to aid debugging. Troubleshoot computational problems. ## One lesson, every learner ### Multilingual Learners - Debugging-step cards. - Frame: "first I notice, then ___." - Debug a tiny program. ### Support & Access - Use 3 core steps. - Fix one small bug. - Use a checklist. ### Stretch & Extend - Debug a logic error. - Use print statements. - Debug a partner’s code. ### What to gather - 📽️Screen / board - 🐛Debug-step cards - 💻Order the Debugging Steps - 📄Buggy code snippet - 📓Notebooks - 🎫Exit-ticket slips ### Key terms - **bug**: an error in code - **debug**: find and fix a bug - **error message**: a clue about a problem - **syntax error**: a typo in the code - **logic error**: code runs but is wrong - **test**: check if code works - **trace**: follow the code - **fix**: correct the problem ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### Reflect: debugging. Have students debug a broken program one step at a time. A printable buggy-code sheet is in the CS library. ## Check your understanding **1. What does “bug” mean?** - an error in code *(correct)* - check if code works - a clue about a problem - find and fix a bug “bug” means: an error in code **2. Which word means: “find and fix a bug”?** - trace - test - bug - debug *(correct)* “debug” means: find and fix a bug **3. What does “error message” mean?** - a clue about a problem *(correct)* - code runs but is wrong - correct the problem - find and fix a bug “error message” means: a clue about a problem **4. Which word means: “a typo in the code”?** - bug - syntax error *(correct)* - logic error - fix “syntax error” means: a typo in the code **5. What does “logic error” mean?** - correct the problem - check if code works - code runs but is wrong *(correct)* - an error in code “logic error” means: code runs but is wrong **6. Which word means: “check if code works”?** - fix - syntax error - test *(correct)* - error message “test” means: check if code works ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g7-cs-debugging.html All lessons: https://lessonplans.k12academics.com/