Re: UML-ish question



In message <1143042024.687189.59020@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, "jhinchey@xxxxxxxxxx" <jhinchey@xxxxxxxxxx> writes
I came across something on a UML class diagram today that I have never
seen before and I'm wondering about the validity of it. The diagram
has a class which has an association with itself (a line coming out of
the class, making 2 90 degree turns and going back into itself).

Is that legal UML?
Yes.
If so, what does it mean?
It denotes that in general, one instance of the class can have a link to another instance of that class. But for a Singleton object, it would be a link with itself.

The exact meaning will depend on the meaning of the association. E.g. for a Component class, it could be that a component object could contain other components, or, for say an electrical component, the association could model electrical connection between one component and other(s).

I think they are trying
to show an association between two instances of the class, which I
don't think belongs on the class diagram.

You could have objects on a "class diagram", but usually it's just classes. And a line between objects represents a link, of course. A line drawn between two classes represents an association - which models, basically, the potential for links between objects of the classes involved. And for there to be a reflexive association is certainly legal.

--
Alec Ross
.