DEBUGGING AND DEBUGGING TECHNIQUES FOR CODE NEWBIES

DEBUGGING AND DEBUGGING TECHNIQUES FOR CODE NEWBIES

·

3 min read

Debugging is the process of finding and resolving errors or defects from a software so that it runs as expected to.

STEPS FOR DEBUGGING PROCESS

  1. IDENTIFY THE DEFECT Sometimes is easy to spot bugs in your software because your software might totally crash, other bugs might be little and hard to notice without testing the software multiple times with different scenarios.

  2. FINDING THE SOURCE OF THE BUG: In small projects, finding the source of the bug might not be so hard, this is why debugging techniques are useful.

  3. Correcting the problem: After finding the bug, you still have to solve the defect, online forums such as stackoverflow are always helpful.

DEBUGGING TECHNIQUES FOR NEWBIES

In order to find and fix bugs in a program, you should follow some debugging approach, some of the most common are: • Debugging by brute force • Backtracking strategy • Deduction strategy.

DEBUGGING BY BRUTE FORCE: This is the most common debugging approach but often the most time consuming. This involves the developer manually searching through memory dumps, stack-traces, log files etc, for traces of error print statements and break points and other output statements are added to the code in order to examine what the software is doing at each step. Memory dumps is a captured image of the program, showing its state at only one instant in time, the image may not be captured at the exact point of error.

BACKTRACTING STRATEGY: This debugging technique involves the developer starting from the statement at which the error symptom was discovered, then backtracks through the execution path looking for the cause of the error. The execution path of a program may be so dynamic and can become large, so the quantity of potential backward methods will increase and may become tedious.

DEDUCTION TECHNIQUES: In this technique, a list of hypothesis of the probable cause of the bug is drawn up by the developer, tests will be run to prove the hypothesis and locate the bug, sometimes code blocks may be deleted or commented out and using information gotten from the test, the bug maybe located or a new hypothesis is drawn up and tests carried out.

You can also take a step back and have a fresh look, that's a way to debug the developer.