While listening to Perlcast’s interview with Pragmatic Andy Hunt, Andy said “Bugs tend to clump together.” I’ve said that many times myself — it seems to be true — but I never asked why.

I can think of two reasons immediately. First, complexity is one of the biggest enemies of effective software development. A complex section of code seems more likely to hide programming errors than a simple section of code.

Second, and perhaps more importantly, a piece of code for a poorly-understood customer requirement seems more likely to have bugs than a piece of code for a well-understood requirement.

Programmers have a decent sense of overcomplexity, at least if we can recognize that a piece of code is inelegant. Yet how do we develop our sense to find code that meets customer needs very poorly?