On 22 July 2013 16:23, Nicolas Cellier <nicolas.cellier.aka.n...@gmail.com> wrote: > Because the quaternion (ar + ai * i + 0 * j + 0 * k) will behave exactly > like a complex (ar + ai * i) with respect to arithmetic (+ - * /) and > elementary functions (exp sin cos etc...). > all i know is that
i*i = -1 that's what makes complex numbers quite different from other n-dimensional vector(s). and i never seen that you can mix complex algebra and linear algebra.. hence, i can imagine that you can subclass both from some abstract NDimensionalVector but not subclass one from another, because it makes no sense. > > 2013/7/22 Igor Stasenko <siguc...@gmail.com> >> >> On 22 July 2013 15:13, Florin Mateoc <fmat...@gmail.com> wrote: >> > 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. >> >> I say you what. If you go to extreme, then your object can do >> everything.. and so you end up with code like this everywhere: >> >> self foo: self bar with: self zork. >> >> Because your object knows everything, can do everything and don't >> needs anything. >> The only question which remains is why you using object-oriented language >> then? >> Why using classes, caring about inheritance, polymorphism , message >> passing etc, because >> if single object does all you need, you don't need all of above. >> >> My point is that if you don't need such concepts, just don't use >> them.. but if you using them, >> then please follow the rules. >> >> Same goes to Announcer. It defines the certain way how it should be >> used. And how its not. >> >> > A quaternion is a generalization in 4 dimensions, we did not get complex >> > numbers by specializing from quaternions, it >> > was the other way around. >> > >> >> hmm? how that? i first time hear that they are related. >> Can you provide a real example where you can mix both of them >> interchangeably? >> Besides the fact that they both are partial case of n-dimentional >> vectors, they not sharing too much, >> because of different math and different uses. >> >> But anyways.. it seems like Announcement(s) model, to my thinking >> don't really fits well with >> observer pattern. >> Because in observer pattern you need only 2 roles: observer(s) and >> subject. >> You don't have nor need a mediator or 'event dispatcher', which >> represented by announcer. >> >> Implementing an observer pattern using Announcer is an overkill, to my >> thinking. >> Reflecting by your example, is like using quaternions where complex >> numbers is sufficient. >> >> I think more and more, in this regard, that Announcements is not a >> silver bullet and it has own limits >> and intended ways to use. >> For that matter, i think we should have more simple and elegant solution. >> Because subclassing from Announcer is not a solution. >> >> >> -- >> Best regards, >> Igor Stasenko. >> > -- Best regards, Igor Stasenko.