views:

102

answers:

2

Hello All,

Related to this question, http://stackoverflow.com/questions/570353/hardest-types-of-bugs-to-track, does anyone have any examples of real-world code that introduces extremely hard-to-identify bugs, e.g a Heisenbug? If you wanted to deliberately introduce a difficult bug, what would you do?

+1  A: 

I would fail to properly lock concurrent access to a seldom-used, non-critical shared variable, thus introducing a race condition (a good example of an Heisenbug) that would probably make its way into production, then rear its ugly head once every few years with nobody being none the wiser.

Of course, that's only an example. I would never willingly do that. And neither would you, right? Right?

Frédéric Hamidi
absolutely not. this is for interest only.
BugMachine
A: 

Read Java Puzzlers by Joshua Bloch and Neal Gafter.

I'm about half way through it and, as someone quite new to Java, it's been rather eye opening for me.

MatthewD