Sunday, June 1, 2008

The Art of Debugging

The Art of Debugging

Debugging happens as a result of testing. When a test case uncovers an error, debugging is the process that causes the removal of that error.

2.6.1 The Debugging Process

Debugging is not testing, but always happens as a response of testing. The debugging process will have one of two outcomes: (1) The cause will be found, corrected and removed, or (2) the cause will not be found. Why is debugging difficult?

  • The symptom and the cause are geographically remote.
  • The symptom may disappear when another error is corrected.
  • The symptom may actually be the result of nonerrors (eg round off in accuracies).
  • The symptom may be caused by a human error that is not easy to find.
  • The symptom may be intermittent.
  • The symptom might be due to the causes that are distributed across various tasks on diverse processes.

2.6.2 Psychological Considerations

There is evidence that debugging is an innate human trait. Some people are good at it and others not. Although experimental evidence on debugging can be considered in many ways large variations in debugging ability has been identified in software engineering of the same experience.

2.6.3 Debugging Approaches

Regardless of the approach that is used, debugging has one main aim: to determine and correct errors. The aim is achieved by using systematic evaluation, intuition, and good fortune. In general three kinds of debugging approaches have been put forward: Brute force, Back tracking and Cause elimination.

Brute force is probably the most popular despite being the least successful. We apply brute force debugging methods when all else fails. Using a “let the computer find the error” technique, memory dumps are taken, run-time traces are invoked, and the program is loaded with WRITE statements. Backtracking is a common debugging method that can be used successfully in small programs. Beginning at the site where a symptom has been uncovered, the source code is traced backwards till the error is found. In cause elimination a list of possible causes of an error are identified and tests are conducted until each one is eliminated.

2.7 Conclusion

Software testing accounts for a large percentage of effort in the software development process, but we have only recently begun to understand the subtleties of systematic planning, execution and control.