Site Archive (Complete)
C++ Blog: The zeroth rule of debugging
C++
void main(void)

Calls, Returns and In-Between.

by Kevin Carlson
SELECTIVE IGNORANCE

Finding the Signal in the Noise

by Andrew Koenig
September 06, 2007

The zeroth rule of debugging

My last post generated a few comments, one of which made a suggestion for what should be the second rule of debugging. I agree with that suggestion, and will elaborate on it later. But there is another rule that is even more important--so important that I see little alternative to calling it the zeroth rule.

Here's the rule: Before you go hunting for bugs, be sure that what you're seeing is a bug.

I've lost track of how many times someone has come to me complaining about what turns out to be correct behavior. The first example of such behavior that comes to mind is expecting (1.0/3)*3 to be equal to 1.0; but there are plenty of other such examples.

If a program's behavior doesn't match your expectations, it just might be your expectations that are incorrect.

Posted by Andrew Koenig at 01:41 PM  Permalink




 
INFO-LINK


Related Sites: DotNetJunkies, SD Expo, SqlJunkies