On 7/22/2013 8:44 AM, Igor Stasenko wrote: > On 22 July 2013 14:13, Florin Mateoc <fmat...@gmail.com> wrote: >> I also liked the debate, so before it closes I want to throw my 2 cents in: >> >> I don't think this is an issue about inheritance (vs composition), it is one >> about multiple inheritance or lack thereof. You may want your object to be >> an announcer of events, but almost always you will also want it to be >> something else as well. To me this suggests that Announcer should be a >> trait, not a class, so in a sense, indeed, you would "compose" your classes >> using it, but you would use trait composition instead of class composition. >> In VisualAge there is a huge hierarchy underneath AbtObservableObject. Sure, >> there are many classes that want to participate in an observable pattern, >> but you should not be forced to inherit from a particular class in order to >> do that, so that is just another related example that would have benefited >> from traits. >> > Again, announcer of events means event source role. > It is distinct from 'delivery service' role. > > When you write mail, you just drop it into mailbox, and then mr. > Postman delivers it to receiver, > but not directly yourself. > That's what you get from specialization. > But if you wanna play as mr. Postman, and also will deliver pizzas, > and fly to the moon, > this is called generalization, and straightly opposite to specialization. > >
So what? The thing is, you want to do both. We think in both directions. Sometimes we generalize from the existing knowledge, sometimes we specialize from the abstract. A quaternion is a generalization in 4 dimensions, we did not get complex numbers by specializing from quaternions, it was the other way around. Florin