UML Class Diagram Arrows Guide

Paul Rumyancev
3 min readSep 23, 2020

--

Class Diagrams are the most common and easy way to depict the basics of a system’s design. The arrows that represent relationship between classes and interfaces are the most important but the most challenging part of Class Diagrams. People often face the problem of choosing the right type of the arrow to reflect the nature of relations between entities.

This guide aims to help you with choosing the right arrow types and quickly come up with an elaborate class diagram.

But, first of all, a few words about Association, Composition and Aggregation.

Composition and Aggregation are subtypes of Association that can be used interchangeably depending on specifics of relationship between entities you want to depict on a diagram.

Association

Association Arrow

An Association reflects relation between two classes. Use Association arrow when two classes need to communicate and either (or both) class(es) hold reference to the second one. Association relationship is “stronger” than Dependency relationship, it implies a closer connection between entities.

Example 1. Association arrow usage

Aggregation / Association

Aggregation Arrow

Aggregation implies that two classes are associated, it brings in more details regarding the nature of the relationship: the child can exist independently of the parent.

Example 2. Aggregation arrow usage. HealthBar can exist independently of Player
Example 3. Aggregation arrow usage. Controller can exist independently of the View

Composition / Association

Composition implies that two classes are associated and it adds the following details: within a Composition sub-objects are strongly dependent on a whole. Objects of the types are instantiated together and have common lifecycle.

Example 3. Composition arrow usage. Player and PlayerMovementController are highly dependent on each other and together build up a single whole

Dependency

Dependency Arrow

Dependency relationship implies that two elements are dependent on each other. It is used to reflect that one class interacts with another one, receives an instance this class as a method parameter. Compared to Association, Dependency relationship is weaker.

Example 4. Dependency arrow usage.
Example 5. Dependency arrow usage.

Implementation

Implementation Arrow

Interface implementation.

Example 6. Implementation arrow usage.

Inheritance

Inheritance Arrow

Use Inheritance when you want to show that one class inherits from another one.

Example 7. Inheritance arrow usage.

Enjoyed the article? Follow me on Instagram for more insights on game architecture and software design.

--

--