Use a waypoint shape to connect an association class in UML class diagrams
Association classes in UML class diagrams ‘hang’ off the relationship between two other classes. Instead of leaving an unconnected end on your connector, add a waypoint shape between them and connect all three class shapes to the waypoint shape.
Class diagrams are one of the most common and important type of UML diagram. The waypoint shape keeps your diagram organised and allows you to connect two (or more) connectors together.
Learn about UML class diagrams and how to create them in draw.io
Connect an association class
-
Search for the
Waypoint
shape in the shape panel in draw.io. -
Drag the waypoint shape onto the drawing canvas between your three classes.
-
Drag connectors between each of the classes and this waypoint shape.
If you are having trouble attaching a floating connector to the waypoint shape (the blue outline), hold downAlt+Shift
as you drop the connector on the waypoint shape. -
Set the end arrow styles and enter labels as needed on each of the connectors. Note that association classes in UML use a dashed line.
Now, if you move any of the classes, you won’t lose that association connection to both of the classes.
When to use association classes
Association classes store additional information about the relationship between two classes - the characteristics stored in the association class belong to the relationship itself and not the two related classes.
For example, the Enrolment association class contains the extra information that only exists when a student enrols in a course - their chosen semester and their grade.
UML association classes can contain operations, attributes, and other associations, just like normal UML classes.
It’s good practice to ensure that every instance of an association class should have a unique source and target pair of classes.
Other types of UML diagrams
There are many different types of UML diagrams used to describe both the structure and the behaviour of complex systems and processes.
See how you can create the following UML diagrams in draw.io.