Lesson IdeasTeaching Strategy

How to use debugging skills to teach critical thinking in stem classes

Debugging is a standard industry practice in software development. Debugging also teaches middle school students a variety of skills that are useful outside of STEM classes, no matter what discipline they choose to study.

Foster critical thinking skills through debugging

The best programmers (and scientists, musicians, writers, mathematicians, among others!) engage in the skills that debugging teaches.

One skill is problem solving and scientific thinking through the scientific method. After all, debugging involves being presented with a problem in code, and then reasoning about what might be causing the problem. This process requires students to analyze a situation, hypothesize causes, and test solutions, similar to the scientific method.

To be successful at debugging, students must critically assess the behavior of code, and attend to many details (sometimes as small as a single comma or parenthesis) to determine what might be causing the problem.

Engaging in the debugging process, especially testing various solutions, requires a lot of persistence and resilience, and can build [frustration tolerance](https://www.verywellmind.com/how-to-deal-with-low-frustration-tolerance-4780883#:~:text=The ability to deal with,traffic jams and noisy kids.) in young learners, which is a critical skill for college and career.

Debugging exercises to do in class

Debugging exercises are a lot like word problems in math, with the added benefit that they can be solved with or without tools, alone or in pairs, and with varying degrees of difficulty. For any coding language, you can try exercises with the following types of problems:

  1. Syntax errors only: provide the students a sample of code that has one or more syntax errors. For students just starting, you might only choose one type of syntax error. As students advance, you may include multiple types of syntax error in the same code example.
  2. Semantic errors only: provide the students with examples of code that might compile correctly, but that runs in an unintended way due to semantic (logic-based errors) in the code including the way that arithmetic, looping, or conditional errors.
  3. Combination errors: as students advance, provide code examples that include both syntax and semantic errors. These exercises will be more beneficial to students if they are related to the topic you are teaching in class at the time.

Measuring student debugging skills

Debugging can be used as a formative or summative assessment, depending upon how the problems are used in class.

For formative assessments, students can work in groups while you observe their debugging practice. You can make notes about their approach, make suggestions, and learn about where they are in their understanding of different code skills in class. You can also ask students to engage in group or mob debugging, where they work as a group or a class to explain what is wrong in the code, and why they have the hypothesis they do. A practice called mob programming can be very interesting in this context, and allow you to get a sense of where you may need to give more instruction.

Summative assessments might include asking students to debug intentionally buggy code and write a reflection about their process, as well as what they learned through debugging. Having students perform peer assessments using a detailed rubric to foster collaboration and communication, as well as assess how students are understanding code.

By integrating debugging exercises into your curriculum and using a combination of the above methods, you can effectively incorporate critical thinking skills into your code classroom.

Leave a Reply