Re: UML notation question...
From: Shashank (shashank_at_icmgworld.com)
Date: 05/19/04
- Next message: JXStern: "Re: Why is OO popular?"
- Previous message: Cristiano Sadun: "Re: Whatever happened to reuse?"
- Next in thread: H. S. Lahman: "Re: UML notation question..."
- Maybe reply: H. S. Lahman: "Re: UML notation question..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 19 May 2004 22:35:00 +0530
How much should the identification of classes (different roles of employee is
identified as different classes here) be blamed for these un-resolved complexity in
relationship?
regards,
Shashank
"H. S. Lahman" wrote:
> Responding to Hartley...
>
> > Suppose I have the following situation :
> >
> > an A must be either a B or a C
> > a B might be a C (or vice-versa), but might not.
> > However, B's and C's are all D's.
> >
> > Is UML expressive enough to capture fully all the above information? If so, how??
>
> You can't get there from here, but the problem lies in the way the OO
> is-a relation is defined, not with UML. The problem is your second
> specification line.
>
> An OO is-a relation is essentially a Venn Diagram in tree form.
> Subclasses represent complete subsets of the superset. OO
> classification defines set participation based upon the collection of
> properties for those sets. So
>
> [A]
> A
> |
> +---------+-----------+
> | |
> [B] [C]
>
> is just fine for your first specification. The problem is that an OO
> superclass also represents the intersection of shared properties for all
> set members. That means [B] and [C] describe disjoint sets of
> properties. Therefore a B is always an A and a C is always an A but a B
> can never be a C.
>
> Similarly, your last specification could be described as:
>
> [A]
> A
> |
> +-------------+
> |
> [D]
> A
> |
> +--------+---------+
> | |
> [B] [C]
>
> Now all Bs and Cs are Ds and they are also As. The problem here is that
> [D] is superfluous. Because the union of subsets must be a complete set
> of [A] and there is no other direct subset of [A] than [D], that makes
> the [D] set identical to the [A] set.
>
> However, you can get close to what you want for the first and last
> specification using multiple is-a relations /IF/ the common properties
> reflect different sets of properties for [A] and [D]. Then one can have:
>
> +-- [B] --+
> | |
> | |
> [A] <|------+ +-----|> [D]
> | |
> | |
> +-- [C] --+
>
> where both [B] and [C] each belong to two different is-a relations, one
> for [A] and one for [D]. However, a B is still precluded from ever
> being a C.
>
> [Even this fails as indicated unless [A] and [D] are joint sets for the
> participants. That's because if both [A] and [D] have exactly the same
> subsets, there is no reason to separate them for reasons similar to
> those I used above for [D] inheriting from [A]. There is an excellent
> discussion of such exotica in Leon Starr's "Executable UML: How to Build
> Class Models", which IMO is the best book available on practical OO
> class modeling by a large margin.]
>
> So one can't express exactly what you want in traditional is-a
> relations. However, your second specification is actually fairly common
> with the most obvious example being roles. That is, an object has
> different behaviors in different execution contexts. This can be
> handled indirectly without [B] and [C] participating in the same is-a
> relation by separating the concerns of the role from the object itself.
> The best example of this is the GoF design pattern called State.
>
> [GoF refers to the Gang Of Four who wrote the classic "Design Patterns"
> book (Gamnma, Helm, Johnson, and Vlissides).]
>
> *************
> There is nothing wrong with me that could
> not be cured by a capful of Drano.
>
> H. S. Lahman
> hsl@pathfindermda.com
> Pathfinder Solutions -- Put MDA to Work
> http://www.pathfindermda.com
> (888)-OOA-PATH
- Next message: JXStern: "Re: Why is OO popular?"
- Previous message: Cristiano Sadun: "Re: Whatever happened to reuse?"
- Next in thread: H. S. Lahman: "Re: UML notation question..."
- Maybe reply: H. S. Lahman: "Re: UML notation question..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|