Programming has now been part of the school computing curriculum in England for almost a decade, with many other countries following suit. For school students, learning to program is coupled with the challenge of bug-fixing errors in their code, also known as debugging.

But why is debugging such a struggle for so many students? And what can we do to improve students’ experiences with it?

Teacher helping frustrated student at their computer

Being able to debug is a necessity for any aspiring programmer. Errors cannot be avoided when programming, no matter how expert you are. As a result, programmers need to be confident in their debugging ability, which becomes more important as their programs become larger and more complex.

Even for young people who do not wish to go on to study computing after school, debugging is a useful skill. Some researchers consider it a “special case of troubleshooting”¹, making it an ideal way of learning problem-solving skills that can be used in other subjects. Students can also benefit from the perseverance needed to bug-fix, giving the skill affective benefits too.

What makes debugging so difficult?

It’s no secret that fixing bugs is difficult when learning to program. This is completely understandable; learners have to understand program concepts, sequencing, syntax, and more when starting out, which is hard to keep track of. Things aren’t helped by the wealth of sometimes cryptic error messages that may be spewed out to students, making bug-fixing far from simple.

That isn’t all. These challenges often lead to emotional reactions in learners, which is no different for secondary students. Research indicates that these tend to be more often negative than positive, with undergraduates in one study mentioning feelings of confusion, frustration, and desperation when struggling with debugging². I’m sure many teachers have witnessed these reactions in their classrooms.

This is not what we want for students learning to program. We cannot expect students who find debugging difficult to benefit from or engage with the subject, let alone enjoy it. Alternatively, students may see the merit of computing, but not see themselves as “clever enough to do it”. Either way, it’s vital that students’ first experiences of debugging are positive; they will benefit from this problem-solving even if they don’t go on to become programmers.

Despite the importance and challenges of debugging, we know little about how secondary students, who begin learning their first text-based programming language, feel and fare with debugging.

Making debugging easier for students

As a first-year PhD at the research centre, I’ve decided to focus my research on this area. Debugging is a useful skill that is often a source of struggle, which I would like to change. Before this can be changed, I believe the following needs investigating:

  1. Students’ attitudes and emotions towards debugging (as I mentioned, this is an innate part of debugging, so research should investigate the current state of affairs for this)
  2. Students’ debugging behaviour
  3. Key stage 3 (KS3) computing teachers’ perspectives on debugging teaching

I conducted my first study to investigate the first two points earlier in the year. Now I have a better feel of students’ perspective, it’s time to find out how teachers find teaching debugging.

Ideas for teaching debugging:

Later on in the PhD, I hope to provide some in-depth advice for teachers looking for ways to teach debugging. For now, I can certainly share what I’ve already learned about teaching bug-fixing:

  1. Teach it! There is no explicit mention of debugging in the UK KS3 computing curriculum, leading to it not always being taught in classrooms. But programming can’t be done without debugging, so a good first step is to mention some useful debugging strategies. A good example would be to ask the following questions:
    • What’s not working?
    • What could be causing this?
    • Where could the error be?
    • How do I fix it?
  2. Normalise it: When students get errors, they may believe it’s an indicator of their programming ability, which can cause a variety of negative emotions. It can helpful to emphasise that errors are a normal part of programming; software engineers have reported spending 50% of their programming time debugging in one study³.
  3. Encourage it: As debugging is challenging both cognitively and emotionally, students should be praised for any efforts in attempting to resolve bugs themselves.
  4. Keep an “error catalogue”: Error messages are sometimes hard to break down, so having a list of suggestions or solutions for a particular error message may help students finding it hard to decode what the compiler/interpreter is saying.

What’s next

Now I’ve got students’ perspectives on debugging, I’d like to find out how teachers find teaching debugging. So I’m looking for teachers who would like to take part in an interview on this topic, giving an opportunity to voice their opinions on where my own and similar research could go.

If you’re a KS3 computing teacher (anywhere in the world!), you’d be welcome to participate in the study! To thank you for your participation, you’ll receive a £10 Waterstones voucher.


1) Katz, I. and Anderson, J. [1987], ‘Debugging: An Analysis of Bug-Location Strategies’, Human-Computer Interaction 3(4), 351–399. URL: Analysis_of_Bug-Location_Strategies

2) Kinnunen, P. and Simon, B. [2010], Experiencing Programming Assignments in CS1: The Emotional Toll, in ‘Proceedings of the Sixth International Workshop on Computing Education Research’, Association for Computing Machinery, pp. 77–85.

3) Britton, T., Jeng, L., Carver, G., Katzenellenbogen, T. and Cheak, P. [2020], Reversible Debugging Software “Quantify the time and cost saved using reversible debuggers”, Technical report, University of Cambridge Judge Business School, Cambridge.