[aklug] Re: The Phantom Bug

From: Michael Fowler <michael@shoebox.net>
Date: Fri Apr 17 2009 - 16:46:56 AKDT

On Fri, Apr 17, 2009 at 12:27:30PM -0800, Christopher Howard wrote:
> Hm, I think it must be a Heisenbug. Its one of those weird scenerios (for
> the curious) where the code works perfectly fine with a string of any
> length, unless the string is four elements long (!) I should be able to
> deduce the problem from that, but each time I look at the code I can't
> seem to figure out why it works for two elements or for three elements or
> for five, but not for four. (???)

Doesn't sound like a heisenbug. Sounds more like you just haven't found
the conditions to reproduce it. A heisenbug is more of the class where
the code dies horribly when you run it, but as soon as you run it in a
debugger (or, worse, add print statements around relevant places) it
disappears. These can truly be maddening.

Sometimes it helps to cut your code down to a minimal test case; you can
either isolate the section of code and try various inputs, or (for more
extreme cases) start chopping out large sections of code until the bug
disappears.

It can also be helpful to get another pair of eyes on it. Sometimes in
the course of explaining the problem in detail you discover the problem;
failing that, the person (or people) you're talking to may spot it.

Showing the code is pretty important, though, if you do want more eyes.

--
Michael Fowler
www.shoebox.net
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri Apr 17 16:47:11 2009

This archive was generated by hypermail 2.1.8 : Fri Apr 17 2009 - 16:47:11 AKDT