What is an Association and what is it used for in UML?
A Relationship between UML Classifiers
The term association is used in many areas. In psychology the association describes the conscious or unconscious linking of thoughts, in Marximus a union of workers and in chemistry a grouping of several molecules to form larger associations. In the Unified Modeling Language (UML) as the graphical modeling language of software and system development, an association describes a relationship between classifiers.
Associations in UML usually express relationships between two classes, two interfaces or even two use cases. An association with more than two model elements is called an n-ary association and rarely occurs in the practice of modeling software or systems. An association that refers to the same model element is reflexive.
Graphically, an association is represented by a line between the two model elements and is referred to as a link at the instance level. In the case of an n-ary association, the visualisation is carried out using a diamond and adjoining lines. The ends of an association are also independent model elements; they are modeled with the model element Property and can have a name, a multiplicity, a visibility and a navigability.
Navigability in the UML Association
Basically, there are three types of navigability:
- The permitted navigation from one model element to another; visualised with an arrow at the end of the association.
- The unauthorized navigation from one model element to another, displayed with a small x at the end of the association.
- No specific statement.
Associations can also be classified as unidirectional or bidirectional: An association that allows only one direction is unidirectional, a two-way navigation correspondingly bidirectional. With aggregation and composition there are two special cases of association.