Bug squashing…

Bugs are a fact of life as a developer…there’s no avoiding it.  The really frustrating bugs, though, are the ones that drive you mad and then turn out to be the simplest little thing.  This is where having another fresh mind on the problem can do wonders.

I faced such a bug today.  I’d been looking over it off and on for a couple days and just sat there staring at the screen KNOWING that this code should work.  I’d run over it 1,000 times (approximately) in my head and run it through a battery of test cases trying to isolate the problem…all to no avail.  I then asked the always helpful Josh Fraser for a hand in hunting down the culprit.  He sat down with me, looked over the code, and fully agreed that it should work exactly as I’d expected (though not how it actually was).  He had asked me to run through some test cases, so I asked him for a couple minutes to allow me to hunt down all the samples I’d made the previous couple days.  Just to try to avoid a bit of embarrassment, I decided to look over the test cases and test code I’d setup before I called him back over.  During this process I realized that there was a slight difference between my test code and my code I was debugging that must’ve happened from an inadvertent file copy of an old version or something…in any case the problem became immediately evident after this realization.  Sadly, I then had to swallow my pride and call Josh back over and explain my blunder…so much for avoiding embarrassment.  Of course the embarrassment was a small price to pay to resolve the frustrating problem in my book.

So the moral of the story?  Get someone else to talk through the problem with.  Even if they don’t provide the solution, there’s a chance they’ll help you find it yourself by re-examining what you “knew” to be the case.

This entry was posted in General. Bookmark the permalink.

Comments are closed.