Hi, Can anyone clarify the following questions. 1.What is the significance of multiple classification? 2.Can multiple classification be implemented in Java? 3.What is the difference between Dynamic and static classfication? Thanks in advance William
Where have you found these questions? Can you take an opening shot at any of them? That will help us know what kind of answers you are looking for and where we should start so we don't cover old ground for you.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Nov 21, 2000
Originally posted by Stan James: Where have you found these questions? Can you take an opening shot at any of them? That will help us know what kind of answers you are looking for and where we should start so we don't cover old ground for you.
Hi Stan, My question is based on the content in UML distilled on 'Multiple and dynamic classification'. I am having a problem trying to map what is said as the difference between multiple classification and multiple inheritance to how it can be achived in Java.For the time being I have reconciled that I would implement multiple classification by creating an object whose class implements many disconnected interfaces.Multiple inheritance(which cannot be implemented in java) will therefore be a class being a subclass of multiple superclasses. The book goes on to state how classification can be dynamic and static and how objects can change type in dynamic classification.I am just not able relate this to any implementation in Java. thanks, William
The distinction between classification and generalization (inheritance) is not something I had thought much about before. It's an interesting idea and may make you more comfortable with implementing multiple interfaces.
Multiple inheritance usually means direct implementation inheritance from two (or more) parent classes. This is different from an inheritance hierarchy, where a subtype inherits from its parent, which in turn is a subtype of its parent, (and so on).
I say it usually means that because, depending on the context, multiple inheritance sometimes describes multiple interface inheritance.
Multiple classification gets ugly really fast when you try to implement it. At least when I try to implement it, I should say. On the other hand, if you allow that an actor can only play one role at a time, you can use object inheritance to capture basically the same information as multiple classification.
Objects related through object inheritance represent the same domain entity, just as in multiple classification. You can simulate object inheritance in Jave by having the parent and child implement the same interface, and passing messages to the child directly through to the parent.
You could implement the multiple classification diagram in UML distilled this way. The sex type classification would be reduced to an attribute of Person, the patient classification as another role that a Person could play, (outside the role generalization set), then implement the actor-role relationship through object inheritance.
Again, this is based on the stipulation that an actor can only play one role at a time. My understanding of multiple classification is that, back to the diagram, a Person instance can play the role of a Patient and Doctor at the same time.
Multiple classification is useful for domain/conceptual modeling to show the different ways we are interested in classifying the parent class. I can't remember having seen, or think of an example, of classifications that aren't roles played by the parent, or that can't be reduced to attributes.