Bug in the machine: six top tips for debugging your code

Making mistakes and learning how to solve them is a key part of becoming a coder. Read on to find out about the origins of the word ‘debugging’, and discover our newest resource to help your club members work through troublesome code. 

Programme Coordinator Zoe, holding the new debugging poster against a backdrop of an illustration of a house
Programme Coordinator Zoe, was excited to get her hands on our brand new debugging poster

Making mistakes is a part of learning 

The term ‘bug’ is used to describe a technical problem or mistake in code that stops it from working or behaving as you would expect. Every coder, from total beginners to seasoned experts, will have to deal with coding bugs, and it’s important to know the different approaches that you can take to fix them. 

Debugging’ is the term given to the process of working through your code to find and fix your mistake. Many things can cause bugs, from incorrect logic, to syntax errors, or even something as small as a missed comma. 

Bug in the machine 

The term ‘debugging’ is often attributed to U.S. Navy Rear Admiral Grace Hopper, a computer programming pioneer. In September 1947, Admiral Hopper was working with a team at Harvard on the Mark II computer, when they found an issue in one of the computer’s relays: a small, unobtrusive moth. As the moth was removed and taped into their research logbook, Admiral Hopper is said to have remarked that the team was ‘debugging’ the system. And so, the term was born — or so the story goes!

Whatever its initial origins, today, ‘debugging’ is a term used by programmers all over the world. 

Get debugging in your Code Club! 

We’ve created a new poster to help your Code Club members to debug their code. The poster explains what a bug is, and gives six top tips for Code Club members to try if they find a bug in their code: 

An image of the debugging poster, featuring spiders.
  • Check the project instructions — Have you followed the steps correctly? 
  • Read your code out loud — Does this highlight anything that is obviously wrong? 
  • Find the last time when your project worked — Can you isolate which part of your code is broken? 
  • Show your Code Club leader — Can your club leader help find which bit of your code isn’t working? 
  • Ask a friend — Get another pair of eyes to check your code! 
  • Stay calm and keep trying new things — The most important thing is to not get frustrated; you’ll find your bug if you keep looking! 

If you’re based in the UK, the USA, or Ireland, head to your dashboard to download your copy of our debugging poster. 

If you’re based outside of the UK, the USA, or Ireland, head to our Code Club international website to download this poster and other resources.