Notes Antic Disposition

Software Design Folklore

A while ago, I filled out a survey which attempted to plumb the often awkward intersection of theory and practice in object oriented design.

The results have just been released, and they provide a fairly good overview of colloquial ‘best practice’ or at least an indication that there are definitely areas of common agreement amongst developers who work with OO languages.

There are no totally correct answers for most of these questions. Sometimes what someone learns from experience will contradict received wisdom from the community or rules of thumb that they are taught in university courses.

In particular, there seems to be a lot of dispute over shallow vs deep class hierarchies. Clearly some developers have had great success with deep connected class hierarchies, while others have been bitten badly (my experience tends to make me want to shuffle towards the latter camp).

I think some confusion arises because of the assumption that these are two different strategies for solving the same problem of reusing code. The reality is more subtle than this — inheritance models an is-a relationship, whereas composition breaks functionality down into modular ‘pluggable’ units. They are interrelated techniques, and need to be used in concert. Perhaps this also indicates that OO developers belong to a certain set of particular personality types.

This is the stuff that makes software development hard. It’s easy to learn how to write code that works, but much harder to learn the concepts and techniques for organizing code at the meta level. My thoughts are that the answers to this survey are positive, indicating that (at least of this cross section of developers) there are fairly good standards and expectations.