# Debugging: Finding the Fix > Fifth graders learn debugging — the essential skill of finding and fixing the mistakes (“bugs”) in code — and discover that every coder makes mistakes, so… **Computer Science** | **Grade 5** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g5-debugging.html* Fifth graders learn debugging — the essential skill of finding and fixing the mistakes (“bugs”) in code — and discover that every coder makes mistakes, so patient problem-solving is part of the fun. **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… - Explain what a **bug** is. - Explain **debugging**. - Find a mistake in **steps**. - Stay **persistent**. Even the best coders in the world make mistakes! When a program doesn’t work, the trick isn’t to give up — it’s to become a code detective. How do we find and fix the bugs? ## Debugging Check Project each item and have students answer about debugging. The tool explains bugs and how to fix them. ## 40 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Everyone Makes Bugs Even great coders make mistakes — so what do they do when code breaks? #### 👩‍🏫 Teacher Moves - Show a broken program. - Ask how to fix it. - Set the goal. #### 🎒 Student Actions - See the bug. - Wonder how. - Predict debugging. ### Unplugged — Unplug It Students practice. #### 👩‍🏫 Teacher Moves - Find the mistake in an algorithm. - Fix the wrong step. - Test it again. #### 🎒 Student Actions - Find it. - Fix it. - Test it. ### Use — Debugging in Code Students use the tool. #### 👩‍🏫 Teacher Moves - Send students to Debugging Check. - Note what a bug is. - Note how to fix it. #### 🎒 Student Actions - Answer them. - Note bugs. - Note fixing. ### Modify — Change It Students modify. #### 👩‍🏫 Teacher Moves - Fix a buggy set of steps. - Test the fix. - Explain the bug. #### 🎒 Student Actions - Fix it. - Test it. - Explain it. ### Create — Create Students conclude. #### 👩‍🏫 Teacher Moves - Debug a partner’s steps. - Explain the fix. - Complete the exit ticket. #### 🎒 Student Actions - Debug it. - Explain it. - Complete the exit ticket. ## Built to the standards you report on Aligned to the CSTA K-12 Computer Science Standards and ISTE Standards for Students. Test and debug a program to ensure it runs as intended. Take on roles when collaborating to fix programs. Create and correct programs. Computational Thinker — persist and troubleshoot. ## One lesson, every learner ### Multilingual Learners - Bug/fix picture cards. - Sentence frame: “The bug is ___; I fixed it by ___.” - Fix a wrong step together. ### Support & Access - Start with one obvious bug. - Fix one step. - Test right away. ### Stretch & Extend - Debug a longer program. - Explain a tricky bug. - Help a friend debug. ### What to gather - 📽️Projector / board - 🐛Buggy step cards - 💻Debugging Check - 🔍Magnifiers (detective fun) - ✏️Pencils - 🎫Exit-ticket slips ### Key terms - **bug**: a mistake in code - **debug**: to find and fix mistakes - **error**: something that’s wrong - **test**: to try the program - **fix**: to correct a mistake - **persistent**: not giving up - **troubleshoot**: to hunt for problems - **program**: a set of instructions ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### Create: be a code detective. Have students trade a set of instructions with a partner, hunt for any bugs, and fix them together — celebrating persistence. A printable debugging sheet is in the Computer Science library. ## Check your understanding **1. What does “bug” mean?** - not giving up - a mistake in code *(correct)* - to correct a mistake - a set of instructions “bug” means: a mistake in code **2. Which word means: “to find and fix mistakes”?** - program - debug *(correct)* - test - troubleshoot “debug” means: to find and fix mistakes **3. What does “error” mean?** - a mistake in code - something that’s wrong *(correct)* - to find and fix mistakes - a set of instructions “error” means: something that’s wrong **4. Which word means: “to try the program”?** - test *(correct)* - fix - bug - program “test” means: to try the program **5. What does “fix” mean?** - to correct a mistake *(correct)* - not giving up - to find and fix mistakes - something that’s wrong “fix” means: to correct a mistake **6. Which word means: “not giving up”?** - persistent *(correct)* - error - troubleshoot - debug “persistent” means: not giving up ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g5-debugging.html All lessons: https://lessonplans.k12academics.com/