Hi Igor,

I love these discussions. I agree that abusing inheritance is counter-productive. Definitely, "Shampoo subclass: #Shower" does not match any mental model I can think of.�But, I am not seeing "Announcer subclass: #MyDomainConcept"�equally as an abuse.

Here is why.

When I say "Object subclass: #MyDomainConcept", my actual intention is not to reuse types necessarily, but rather the infrastructure needed for the Smalltalk runtime. From this point of view, it is an implementation inheritance. I could as well, inherit from ProtoObject, but I do not do it because Object gives me a bit more technical infrastructure.

For me, Announcer is nothing but an Object that has an extra technical capability. Inheriting from Announcer rather than Object seems the same as inheriting from Object rather than ProtoObject.

Now, you can shoot.

Cheers,
Doru




On Fri, Jul 19, 2013 at 3:32 PM, Igor Stasenko <siguctua@gmail.com> wrote:
I just stumbled upon this:

Announcer subclass: #TxEditor
� � � � ....

This is just plain wrong, as wrong as:

Shampoo subclass: #Shower

because every time you treat inheritance as something else as
_specialization_ you doing it wrong.
Inheritance is not about importing needed functionality, it should be
about specialization and only about it:
�- a superclass provides generic functionality, while subclasses
providing more and more specialized forms of it.

Because if we don't follow that, then it is really hard to see and
follow a structure in design.. it is just random.

And here's why:

so since shower uses shampoo, as we concluded, then why not including
it via inheritance:

Shampoo subclass: #Shower

but then, Shower also uses Soap, so maybe it should be like that:

Soap subclass: #Shower

so, which superclass you prefer most? And how do you pick/prioritize
which element should be a superclass of Shower?

To solve this dilemma, i think we will need multiple inheritance:

(Shampoo, Soap) subclass: #Shower

but thankfully, we don't have it in classic smalltalk model :)

So, then maybe it should be something like that:

Object subclass: #Shower
instanceVariableNames: 'soap shampoo'
...

Anyways, despite the obvious abuses, i'd like to ask community, in
what cases , you think (ab)using inheritance in a way
like above is justified?
Because maybe it is i, who doing it wrong?


--
Best regards,
Igor Stasenko.




--
www.tudorgirba.com

"Every thing has its own flow"