# The Debugging Process > Eighth graders build programming skills by learning a reliable process for finding and fixing bugs - reproduce it, locate it, understand it, fix it, and test - and put the steps in order. **Computer Science** | **Grade 8** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g8-cs-debugging-process.html* Eighth graders learn that debugging is a process, not luck, from reproducing a bug and locating it to fixing it and testing the fix, and put the steps in order. **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… - Reproduce a **bug**. - Locate the **cause**. - Fix and **test**. - Order the steps. Debugging is a skill, not luck. What are the orderly steps that take you from “it doesn’t work” to a fix you can trust? ## Order the Steps Project this and put the debugging steps in order — tap each step from reproducing the bug to testing the fix. ## 55 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — It Doesn't Work! Your program runs but gives the wrong answer. Guessing wastes time. What is a smart, orderly way to track down the bug? #### 👩‍🏫 Teacher Moves - Show a buggy result. - Ask how to find it. - Set the goal. #### 🎒 Student Actions - Think. - Share. - Get ready. ### Use — Order the Steps Students put the debugging steps in order. #### 👩‍🏫 Teacher Moves - Send students to Order the Steps. - Order the steps. - Name each one. #### 🎒 Student Actions - Order. - Say. - Note it. ### Modify — Find the Bug Students debug a small program. #### 👩‍🏫 Teacher Moves - Read a short buggy program. - Locate the error. - Explain the cause. #### 🎒 Student Actions - Read. - Locate. - Explain. ### Create — Debug Log Students build a debugging log. #### 👩‍🏫 Teacher Moves - Describe a bug. - Record each step you take. - Note the fix and test. #### 🎒 Student Actions - Describe. - Record. - Note. ### Reflect — Fix It, Then Prove It Students reflect on testing the fix. #### 👩‍🏫 Teacher Moves - Why reproduce a bug first? - Why test after fixing? - 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 refine programs. Use a process to find and correct errors. Document a program to make debugging easier. Troubleshoot problems methodically. ## One lesson, every learner ### Multilingual Learners - Step cards with icons. - Sentence frame: “First I ___ , then I ___ .” - Order two steps at a time. ### Support & Access - Start with 'reproduce the bug'. - Debug one example together. - Add one step at a time. ### Stretch & Extend - Apply the process to a real bug. - Add print statements to locate it. - Write a test that catches the bug. ### What to gather - 📽️Projector / board - 🖼️Debug-step cards - 💻Order the Steps - 🐛Sample buggy programs - ✏️Pencils - 🎫Exit-ticket slips ### Key terms - **bug**: an error that makes a program behave wrongly - **debugging**: the process of finding and fixing bugs - **reproduce**: to make a bug happen again on purpose - **trace**: to follow code step by step to find an error - **root cause**: the real reason a bug happens - **test case**: an input used to check a program's behavior - **regression**: a new bug caused by a change - **breakpoint**: a spot where you pause code to inspect it ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### Create: a debug log. Have students describe a bug, record each step they take to track it down, and note the fix and the test that proves it, building a habit of orderly debugging. A printable debugging worksheet is in the Computer Science library. ## Check your understanding **1. What does “bug” mean?** - an error that makes a program behave wrongly *(correct)* - the process of finding and fixing bugs - to make a bug happen again on purpose - to follow code step by step to find an error “bug” means: an error that makes a program behave wrongly **2. Which word means: “the process of finding and fixing bugs”?** - bug - debugging *(correct)* - reproduce - trace “debugging” means: the process of finding and fixing bugs **3. What does “reproduce” mean?** - an error that makes a program behave wrongly - the process of finding and fixing bugs - to make a bug happen again on purpose *(correct)* - to follow code step by step to find an error “reproduce” means: to make a bug happen again on purpose **4. Which word means: “to follow code step by step to find an error”?** - bug - debugging - reproduce - trace *(correct)* “trace” means: to follow code step by step to find an error **5. What does “root cause” mean?** - the real reason a bug happens *(correct)* - an error that makes a program behave wrongly - the process of finding and fixing bugs - to make a bug happen again on purpose “root cause” means: the real reason a bug happens **6. Which word means: “an input used to check a program's behavior”?** - bug - test case *(correct)* - debugging - reproduce “test case” means: an input used to check a program's behavior ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g8-cs-debugging-process.html All lessons: https://lessonplans.k12academics.com/