Debug the simple things first

What's the moral of these tales? Always check the simplest things first. Many is the time that I've seen novice programmers fighting a bug get stuck by this.

They make an assumption about what they think the problem is and then, like an amoral research scientist, they do whatever it takes to prove their hypothesis. They often end up chasing a bug all the way down to the OS code and then proclaim, "There is a bug in the API!"

So my advice is this: When you are chasing a bug, look at the simplest things first. Did you initialize your variables? Are you crossing a boundary condition? Is it a simple picket-fence problem? You will find that it is almost always that simple.

[Peter Provost's Geek Noise]

Amen.

Concentrating mostly on framework development for the past few years, I can't tell you how many times I've run into situations like this.

When problems arise, the natural reaction is to get on the "jump to conclusions" mat and start blaming everything but obvious culprit. More often than not, a problem is a result of faulty use of the platform (forgetting to put in anti-freeze) rather than something wrong with the platform itself (a serious engine problem) - even if the obvious evidence indicates otherwise (no anti-freeze on your driveway).

The moral: do your due diligence when debugging. Don't assume it can't be simple. By default, assume that the problem is simple, and only when you exhause the obvious causes should you search for a more complicated explanation.