Code with Chompers
  • ⚙️ Settings
    • Increase Text Size
    • Decrease Text Size
    • Toggle High Contrast Mode
    • Toggle Dark Mode
    • Reset Settings
  • Outreach Guide
  • K-6 Activities
  • Middle School Outreach
  • High School Outreach
  • About

On this page

  • Description
  • Time Required
  • Materials Required
  • Steps to Conduct the Activity
  • Set-Up
    • Difficulty Breakdown
  • Discussion & Reflection
  • Wrap-Up
  • Learning Outcomes

Activity 5: Debugging

Teaching students to identify and fix bugs in code through hands-on activities.

Grade: 4
Grade: 5
Grade: 6
Time: 30 Minutes

Description

In this activity, students will learn about debugging and the various manifestations of bugs in code. Students will learn how to identify a bug’s presence, methods of resolving it, and distinguishing between different error outputs.

Time Required

  • Estimated Time: 30-45 minutes

Materials Required

  • Debugging Video: Bugs!
  • Debugging Sheet: Debugging Sheet
  • Debugging Answer Sheet: Answer Sheet
  • Pencil

Steps to Conduct the Activity

Set-Up

  • Print out debugging sheet before activity starts or during debugging video (if you are running activity with someone else).
  • Each student should recieve a copy of the debugging sheet, a pencil, and a

Difficulty Breakdown

Introduction

  • Gather all the students together and show them the debugging video.
    • After the video is done, ask them about what they think bugs in coding will look like. Can bugs show up in differeny ways, or just one?
  • Explain to students the different types of errors they may encounter when learning to code.
    • Syntax Errors:
      • due to grammatical or indentation mistakes in the code, which prevents the program from running correctly
      • similar to missspellings or improper punctuation in written language
    • Logic Errors:
      • when lines of code, while syntactically correct, do not produce the intended outcome
      • caused by flawed logic that the computer cannot interpret as intended, leading to incorrect or unexpected results

Beginner

  • Hand out a copy of the Debugging Sheet to every student. Make sure they recieve the ‘Identifying Bugs’ side first.
  • Usng the written examples, explain to students that any instructions that do not make sense or are grammatically incorrect can be identified as bugs.
  • Flip the sheet over. Have students try to identify if the bugs on this side would be syntax errors or logic errors.
  • 🔍 Focus Skills: critical thinking, categorization

Intermediate

  • Hand out a copy of the Debugging Sheet to every student. Make sure they recieve the ‘Identifying Bugs’ side first.
  • Using the written examples, explain to students that any instructions that do not make sense or are grammatically incorrect can be identified as bugs.
  • Flip the sheet over. Have students try to identify the locations of bugs and if they would be syntax errors or logic errors.
  • Have students create instructions that contain Bugs, no Bugs, syntax errors, and logic errors.
  • 🔍 Focus Skills: critical thinking, categorization, error handling

Discussion & Reflection

After the activity has been completed, gather the class for a quick debrief. We can:

  • Explain the similarity between actual code and the activity, emphasizing how debugging requires the skills practiced in the activity.
  • Ask students if they found the activity challenging and what new concepts they learned.
  • Inquire which was harder: identifying bugs or categorizing them.

Wrap-Up

This activity introduces students to the basics of debugging. It highlights common errors in code and methods for addressing them. Engagement in these activities can better prepare students for coding by providing a solid understanding of how to handle errors.

Learning Outcomes

By the end of this activity, students should be able to:

  • Understand the difference between syntax and logic errors.
  • Be able to identify bugs in code and correctly categorize them as syntax or logic errors.
  • Simulate real-life problem-solving by providing the framework of debugging code and handling errors.
Back to top

Footer Image