What is debugging?

Like this? Share with your STEAM friends...

Debugging means finding and removing errors (or “bugs”) from your code.

Computer programmers can sometimes make mistakes (aka ‘bugs’) when writing their code, especially if it’s a large complex program with many lines of code. So, an important part of programming is debugging, which means testing the program constantly, finding ‘bugs’ and removing them.

As a programmer, I sometimes spend more time debugging my program than I spend writing it! 🙂 This can be anywhere between fun, easy, breezy to incredibly frustrating but it helps you become a better programmer and design some amazing programs and apps.

Types of bugs in programming

  • Syntax bugs – this is a bug caused by ‘syntax’ error, which can be a spelling mistake, a missing semicolon, a variable that I forgot to declare. Sometimes these syntax bugs are “fatal”. No worries though, all that means is that the program has crashed and you need to remove the syntax error for it to be able to compile and run.
  • Logical bugs – as its name suggests, it’s a problem with the ‘logic’ of your program. The program continues to work but not in the way that you coded it to. For example, the user presses the “Next” button but the program takes them back to the “Previous” screen.

How do you debug?

While debugging is a dense topic and can be different for each programming language (each one may have its own debugger built in), the process is usually like this –

  • Test the program and find the problem
  • Trace the program step-by-step to reproduce the exact conditions in which the error occurred (for example, pressing the ‘Enter’ key deletes text)
  • Isolate the source code of the problem itself.
  • Analyze the source code, figure out the problem and fix the code
  • Test the entire program a few times to make sure the bug is fixed and that you haven’t added any new ones during this fix.

Sounds like a lot, but I promise you’ll get better at programming as you repeat this process over and over.


Like this? Share with your STEAM friends...

LEAVE A REPLY

Please enter your comment!
Please enter your name here