Header Ads

  • Cybersecurity

    Importance of Debugging

    What is Debugging?

    Definition: Debugging means finding and removing errors (or “bugs”) from your code.
    Computer programmers can sometimes make mistakes (or 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.

    What is debugging


    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 Debugging 

    Debugging can be categorized in two types:

    Syntax bugs – This is a bug caused by ‘syntaxerror, 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. You don’t have to worry much for such bugs, you can easily remove these bugs.
    What is debugging


    Logical bugs – As its name suggests, it’s a problem with the ‘logic’ of your program. The program might continue 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. Sometimes it’s very time consuming to find and resolve "logical bugs".
    How do you debug


    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 –

    1. Test the program and find the problem

    2. Trace the program step-by-step to reproduce the exact conditions in which the error occurred (for example, pressing the ‘Enter’ key deletes text)

    3. Isolate the source code of the problem itself.

    4. Analyze the source code, figure out the problem and fix the code

    5. 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.


    Have you learnt anything useful? Please share to others.

    Check out some useful programming course in
    Digital Quality Academy

    No comments