Naming Your Associations

Naming Your Associations

When you name an association, use a verb phrase that best describes what these two classes do with (or to) each other. If you consider the classes at either end of an association along with the association name, then the whole thing can be read as a sentence, such as, “A client rents a crash dummy.”

Tip Try to find an active verb phrase that relates the two classes. This enables others to understand your diagrams more easily.

Although associations have meaning in both directions, the name you choose should be readable from left to right or from top to bottom when someone is looking at your diagram. When you build class diagrams with many classes and associations, however, you cannot avoid having some of your association names running in the wrong direction. If you must use an association name that reads from right to left or bottom to top, then use a small arrowhead—the name-direction arrow (as in Figure)—to help the reader. Considered as a sentence, the association in Figure reads like this: “Test equipment monitors a crash dummy.”

Click To expand
Figure: Use of arrowheads for reading association names.

Warning Some UML modeling tools (software that helps you draw UML diagrams and may generate code as a result) don’t have the directional-arrowhead feature that UML requires. In such cases, we use the keyboard symbols in Figure as substitutes for the arrowheads. If possible, however, we recommend using name-direction arrows (if your UML modeling tool provides them) to help other developers know exactly what you mean.

Figure: Substitutes for Association-Name Arrowheads


Keyboard Keys



Shift+, (comma)

Read association from right to left



Read association from bottom to top


Shift+. (period)

Read association from left to right


Lowercase v

Read association from top to bottom

Tip We highly recommend that you name your associations. Names emphasize relationships instead of data flow (more about that in the sidebar, “Noname associations”); they also increase the readability of your diagrams by leaps and bounds. After all, UML is all about effective communication with other developers. When we return to a class diagram months after we put it together, the association names help us remember what we had in mind months earlier.

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows