Re: UML "OR" Composition Question
From: Michael Rauscher (michlmann_at_gmx.de)
Date: 05/18/04
- Next message: Neo: "Re: Nearest Common Ancestor Report (XDb1's $1000 Challenge)"
- Previous message: Neo: "Re: Nearest Common Ancestor Report (XDb1's $1000 Challenge)"
- In reply to: H. S. Lahman: "Re: UML "OR" Composition Question"
- Next in thread: H. S. Lahman: "Re: UML "OR" Composition Question"
- Reply: H. S. Lahman: "Re: UML "OR" Composition Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 18 May 2004 08:14:49 +0200
H. S. Lahman schrieb:
> Responding to Rauscher...
>
>>>>>> How do I show in the diagram that class P is composed of either one
>>>>>> instance of class Y OR one instance of class Z?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> The simplest way is:
>>>>>
>>>>> 1 1
>>>>> [X] --------------- [P]
>>>>> A
>>>>> |
>>>>> +--------+--------+
>>>>> | |
>>>>> [Y] [Z]
>>>>>
>>>>> The multiplicity on the relationship limits the participation to
>>>>> exactly one X, which must be a Y or a Z.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> This is a mistake. The above simply says that P contains an X, it
>>>> says nothing about the Y or Z constraint.
>>>
>>>
>>>
>>>
>>> It isn't a mistake for the problem stated.
>>
>>
>>
>> I've to agree with Daniel. First, it's wrong that one X must be a Y or
>> a Z. X isn't abstract class. Second, not showing classes doesn't imply
>> that they don't exist.
>
>
> X must be either a Y or a Z. The subsets are disjoint by definition in
> an OO is-a relation. Otherwise property resolution for inheritance
> would be ambiguous. (OTOH, if there are multiple inheritance trees
> rooted on X, then the subsets of the two trees can be joint with each
> other, which is indicated in UML by employing the same discriminator on
> both relationships.)
Of course can one X not be a Y _and_ a Z. And I didn't say that.
>
> In addition, the union of members of sibling subsets must be a complete
> set of the immediate superset's members, also by definition to support
> unambiguous property resolution for inheritance. Therefore there can't
> can't be any subclasses that aren't shown whose members are relevant to
> the problem. [Nor can one have a superclass with only one subclass,
> despite what some OOPLs allow. Some misguided OOPLs also allow one to
> instantiate a superclass without specifying a leaf subclass as well.]
Since the diagram is only a view to the model, it needs not to show the
complete model. This "may be shown using an ellipsis (. . .) in place of
a child." Therefore the diagram may hide additional classes that are
siblings of Y, Z. Additionally, these additional siblings aren't
relevent to the problem because there may be instances of X itself as
long as X isn't declared as being abstract.
Therefore, using your diagram and even if we assume, that there aren't
additional classes, P may also contain an instance of X which is
obviously not an instance of Y or Z.
Bye
Michael
- Next message: Neo: "Re: Nearest Common Ancestor Report (XDb1's $1000 Challenge)"
- Previous message: Neo: "Re: Nearest Common Ancestor Report (XDb1's $1000 Challenge)"
- In reply to: H. S. Lahman: "Re: UML "OR" Composition Question"
- Next in thread: H. S. Lahman: "Re: UML "OR" Composition Question"
- Reply: H. S. Lahman: "Re: UML "OR" Composition Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|