1
votes

Is it safe to say that in a UML class diagram, if there is an association of n to 1 objects, then the association arrow is pointing from the class associated with n objects to the class associated with 1 object?

n ----> 1

5

5 Answers

3
votes

Not in general. The arrow direction in UML corresponds to navigation possiblities. Hence, if your arrow points from the n objects to the 1 object it means that in your resulting code each of the n objects can access that 1 object. Of course you may also want an association in which that 1 object can access the n objects, so the arrow points in the different direction. (If no arrowhead is given it means that the n objects can access the 1 object and vice versa.)

1
votes

Not precisely. It depends on the type of association. If its an aggregation then the default is bi directional navigability, but you can specify the navigation to be one way. I think that it is entirely up to the designer to decide the direction of the navigation between objects.

1
votes

No. At least in object oriented programming, the one class that has the "1" association (reference in OOP) could equally well have the many references to the other class.

It depends on the design you make.

1
votes

I thought the arrow was more about navigability (i.e. an arrow from A -> B shows that class A knows how to get to B but B does not know how to get back to A) than expressing the cardinality of the relationship.

0
votes

If I can suggest, there are 3 different notions: 1 - Navigability which is modeled by arrow 2 - Cardinality which is modeled by number or star for 0..n 3 - to who belongs the end point of the association which is modeled by a dark point please see extracted from the norm.Examples of class-owned ends