Pages

Thursday, November 28, 2013

Debugging (Part 2)

Where to Start?

Before we start to look at the bug, we have to make sure that the bug happened in a cleanly compiled code. We have to set compiler warnings as high as possible. It is a waste of time to find a problem that the compiler can detect and find for us.

Before starting to fix the problem, gather as much as data as possible. If the bug is reported by a third party, there is greater chance that the accuracy will be less. Always watch the person to get enough details before starting.

Remember two main points:

  1. Interview the user who reported the bug - Gather enough data
  2. Never do artificial tests - Go for brutal and boundary conditions and test everything!


Bug Reproduction

The best way to start fixing a bug is to reproduce it. If we are not able to reproduce it, we’ll never know if it is there or not. Sometimes by forcing yourself to isolate the circumstances that display the bug, you'll even gain an insight on how to fix it.


- summary of Debugging, from The Pragmatic Programmer: from Journeyman to Master

No comments:

Post a Comment