Debugging


Techniques for Finding Errors. Have you tried to ...

  • ... Use all the data available to form a hypothesis?
  • ... Refine the test cases the produce the error?
  • ... Reproduce the error several different ways?
  • ... Generate more data to generate more hypotheses?
  • ... Use results of negative tests?
  • ... Brainstorm for possible hypotheses?
  • ... Narrow the suspicious region of the code?
  • ... Check code that's changed recently?
  • ... Expand the suspicious region of the code?
  • ... Integrate incrementally?
  • ... Be suspicious of routines that have had errors before?
  • ... Use brute force?
  • ... Set a maximum time for quick and dirty debugging?
  • ... Check for common errors?
  • ... Use confessional debugging?
  • ... Take a break from the problem?

Techniques for Fixing Errors. Have you tried to ...

  • ... Understand the problem?
  • ... Check your work? Verify that the fix is correct?
  • ... Relax?
  • ... Confirm the error diagnosis?
  • ... Save the original source code?
  • ... Fix the problem, not the symptom?
  • ... Change the code only for good reason?
  • ... Understand the program as well as the problem?
  • ... Make one change at a time?
  • ... Look for similar errors?

General approach to debugging

  • Do you use debugging as an opportunity to learn more about your program, mistakes, code quality, and problem-solving approach?
  • Do you avoid the trial-and-error, supersitious approach to debugging?
  • Do you assume that errors are your fault?
  • Do you use the scientific method to stablize intermittent errors?
  • Do you use the scientific method to find error?
  • Rather than using the same approach every time, do you use several different techniques to find errors?
  • Do you verify that the fix is correct?
  • Do you use the debugging tools of warning messages, execution profiling, scaffolding, and interactive debugging?