archives

Implementation Inheritance

I have been reading an old LTU thread from 2003 regarding the role of inheritance in Object Theory. It appeared to me that the general feeling of the discussion was that inheritance of interface was preferable to inheritance of implementation.

I have come across this sentiment so many times during my programming career that I am beginning to wonder if implementation inheritance (with all its associated troubles: fragile base classes, unwieldy monolithic class hierarchies, multiple inheritance) should be included in modern Object (or Component) based languages of today or not.

I have been idly wondering: might we better off moving swiftly away from inheritance of implementation and going with a language (and supporting tools) that make it quick and easy to program using interface, composition and delegation? (Interfaces for Polymorphism, Composition for code sharing and encapsulation, Delegation for extension).

One (opposing) comment that jumped out while reading the thread:

"I fear people who like composition. The gravest sin of OO programming is confusing 'is a' and 'has a' relationships. But composition encourages you to munge those concepts"

The poster certainly has a point! But does this indicate a shortcoming with the HasA-IsA meme, rather than composition as an extension mechanism?

So ultimately, my question is: What do LTU readers feel about inheritance of implementation in 2007?

Apologies if I'm seen as flogging a dead horse, but I see so much reliance on implementation inheritance around me that I'm wondering if the issue is fully resolved.