Skip to main content

20 March 2023

Debugging: Scratching the surface

Javier De Las Heras profile image
Written by

Javier De Las Heras

Finding and fixing errors in a computer program is an essential skill for any programmer, as even the smallest mistake can cause a program to malfunction or fail entirely. Debugging teaches many key skills:

  • Perseverance and patience as students need to carefully analyse their code and test their program multiple times to find and fix errors.
  • Critical thinking skills to look through their code and identify where the error might be occurring.
  • Problem-solving skills to break down complex problems into smaller, manageable parts, and to use logical reasoning and creativity to find solutions.
  • Attention to detail as they need to check their code line by line to find errors.
  • Collaboration with peers to learn new strategies for finding and fixing errors.

I hear teachers complaining about learners in year 10 not having the computational thinking skills to obtain the higher grades; the sooner we teach pupils debugging techniques and provide ample opportunities for them to develop them in a methodically and effective way, the better they will be ready for GCSE programming and algorithm/problem solving exam questions.

I am sharing here some strategies you can use with your Key Stage 3 pupils in lessons when they are coding using Scratch:

  • Read through your code!
  • Have a friend review your code!
  • Say it out loud. When I click the flag, this Sprite will move 2 steps, change costume and say hello for 2 seconds.
  • Thoughtful questions and commentsfor helping students get unstuck in Scratch
  • Have student share project with the class- talk it through as a group. Helpful for teachers who are learning as well.
  • Use some sort of screen sharing software or project the project for group discussions.
  • Pull apart blocks that aren't working and add them back together one at a time, incrementally testing your code.
  • Set up a bug wallfor your students.

[Source: Scratched resources for debugging. https://tinyurl.com/2ur7dp2n]

I share below some activities with full resources you can use in the classroom to teach debugging and fixing errors to young learners in your computing lesson:

Pizza Pickle Scratch Debugging Activity: This Computing activity challenges children to debug simple Scratch programs. A simple four-step process for systematic debugging is demonstrated. https://tinyurl.com/mrv84ujv   

Debugging Challenges in Scratch: Multiple Scratch programs unfinished with instructions on how to solve the challenges.  https://scratch.mit.edu/studios/219583

Finally, I would like to share with you this site in which Sean McManus offers some top tips for finding and fixing the 5 most common errors in Scratch programs. Really useful to share with pupils. https://tinyurl.com/yfswexj3

  1. Creating variables for one sprite or all sprites when it should be the other way around. 
  2. Using the wrong (lookalike) block.
  3. Putting the wrong blocks in brackets.
  4. Putting scripts on the wrong sprite. 
  5. Putting blocks in the wrong order.

Please share any other strategies you use if different.

Discussion

Please login to post a comment

Rachael Coultart
23/05/2024 21:46

Thank you for this - some really great suggestions and links.

I’ve been looking at using Litterbox [Litterbox - Analysis of Scratch projects] to support debugging in Scratch and have found it really useful.

Pete Dring
20/03/2023 12:35

This is brilliant - thank you @jdelasheras. I really like @celliott’s scratch resources to help with debugging Scratch – Sheffield eLearning Service where she’s given loads of example scratch games focussing on different skills and concepts, each with a ‘broken’ version that students can use to practice debugging.