Readers Respond to "Is Inheritance Overrated?"

Posted by Phil Weber on November 29, 2002

I've received some good feedback from my article, "Is Inheritance Overrated?" The real issue, it seems, isn't inheritance, but rather strong typing. One of the requirements of this project is that it be more or less self-maintaining: new content types will be added fairly often; my bosses don't want me to have to go spelunking in the code every time that happens. An advantage of my generic framework is that the app's users can maintain the system simply by creating templates and editing data; few (if any) changes to the underlying code will be required. David Bayley thinks the generic framework will be more difficult to maintain than a strongly-typed object model. What do you think?


Posted by David Husnian on December 4, 2002:

I’ve been doing OO development since 1989 with a variety of languages and I came to the conclusion years ago that strong-typing is VERY BAD and VERY non-OO (particularly at the design stage and when dynamicism and flexibility are required).

People don’t want strong typing as we know it, they want strong typing of the public interface. You don’t care (or you shouldn’t care) whether something is an integer (or whatever), you just want it to respond to a set of messages (in this case maybe the set of messages that an integer responds to).

Truth of the matter is, if everything is an object, then everything is of the same “type” and just needs to respond to a specific public interface.

This is hard for hard-core C++ people (and those people that “inherit from” C++) to accept. I spent several years doing C++ but it wasn’t until I branched out into other (and better) OO languages did I achieve a full understanding.

Anyway, there are places for inheritance and places for composition/aggrigation/delegation but this is completely separate from any discussion of strong typing.

Leave a comment