Defect Attractors

I just ran across a term I love. It’s “defect attractor”. I first ran across it in connection with Eric S. Raymond, the famous Open Source anthropologist. But it was actually invented by Les Hatton, a British computer scientist.

From Eric Raymond’s blog article Defect Attractors the definition is as follows:

A “defect attractor” of a program, language, API, or any other kind of software construct is a feature which, while possibly not bad in itself, spawns defects in the design or code near it.

In particular Raymond used this term in the article I read in connection with object oriented class “inheritance”. I couldn’t agree more.

Early in my learning of C++, I had to learn about inheritance as it pertains to class hierarchies, etc. I used it as dictated, but never liked it much. In my life as a working programmer, I’ve used it not much at all. I find the concept pretty contrived. I would have to actively imagine and design instances where I would use need such a paradigm. And I can’t see why I would want to do that.

I’ve mentioned before the parts of object oriented programming which I find useful, and those I do not. Inheritance is one of those I don’t find useful. Now finding out it is also a “defect attractor” validates my original thoughts about it. It is a feature of OO programming which ultimately attracts more defects than it advantages the code it’s used in.