Reference · UML

UML arrows: what each line and arrowhead means

In short

UML arrows differ in two things: the line (solid or dashed) and the end (none, open arrowhead, hollow triangle, hollow or filled diamond). A solid line with a hollow triangle is inheritance (generalization), a dashed line with a hollow triangle is realization of an interface, a dashed open arrow is a dependency, a plain line is an association, and a diamond marks the whole in aggregation (hollow) or composition (filled). In sequence diagrams a filled arrowhead is a synchronous call, an open one asynchronous, and a dashed line a reply.

Updated · by the ChartCraft team · drawings rendered with Mermaid 11.17.2 · part of the UML symbols reference

What do the arrows in a UML class diagram mean?

Seven lines cover every relationship between classes. Read them by asking two questions: is the line solid or dashed, and what is at the end?

ArrowNameMeaningRead it asMermaid
Association: a plain solid line between Teacher and CourseAssociationThe classes are linkedA teacher teaches a courseTeacher -- Course : teaches
Directed association: a solid line with an open arrowhead from Order to CustomerDirected associationNavigable one way: an order knows its customerAn order has a customerOrder --> Customer : placedBy
Generalization (inheritance): a solid line with a hollow triangle pointing at the superclass AnimalGeneralization (inheritance)The subclass is a kind of the superclass. Triangle at the superclassA dog is an animalAnimal <|-- Dog
Realization: a dashed line with a hollow triangle pointing at the interface PayableRealizationThe class implements the interface. Dashed, triangle at the interfaceAn invoice is payablePayable <|.. Invoice
Dependency: a dashed line with an open arrowhead from Report to PrinterDependencyOne class uses another for a while, for example as a parameterA report uses a printerReport ..> Printer : uses
Aggregation: a hollow diamond at the Team end of the line to PlayerAggregationWhole and part; the part can exist alone. Hollow diamond at the wholeA team has playersTeam o-- Player
Composition: a filled diamond at the House end of the line to RoomCompositionWhole and part; the part cannot exist without the whole. Filled diamond at the wholeA house is made of roomsHouse *-- Room

UML 2.5.1 words each one: a Generalization is a line with a hollow triangle as an arrowhead; a Realization is a dashed line with a triangular arrowhead at the realized element; a Dependency is a dashed arrow; shared aggregation adds a hollow diamond and composite aggregation a filled diamond; an open arrowhead on an association end means that end is navigable.

How do you remember the UML arrows?

Line first, end second. Solid lines are structural, permanent relationships; dashed lines are weaker, a use or a promise. Triangles mean is-a, diamonds mean has-a, and an open arrowhead means knows about or uses.

EndSolid lineDashed line
No endAssociation(a link to a note or constraint)
Open arrowheadDirected associationDependency
Hollow triangleGeneralization: is a kind ofRealization: implements
Hollow diamondAggregation: has, part can live alone
Filled diamondComposition: owns, part dies with it

Which way do UML arrows point?

Triangles and open arrowheads point at the class that is depended on: the superclass, the interface, the used class. Diamonds sit at the other end, on the whole, not the part.

DrawingSay it like this
Generalization (inheritance): a solid line with a hollow triangle pointing at the superclass AnimalDog inherits from Animal. The triangle touches Animal.
Realization: a dashed line with a hollow triangle pointing at the interface PayableInvoice implements Payable. The triangle touches the interface.
Composition: a filled diamond at the House end of the line to RoomA house is composed of rooms. The diamond touches House, the whole.
Dependency: a dashed line with an open arrowhead from Report to PrinterReport depends on Printer. The arrow points at what is used.

What do the arrows in a sequence diagram mean?

In UML 2.5.1 an asynchronous message has an open arrowhead, a synchronous message a filled arrowhead, and a reply message a dashed line with an open or filled arrowhead.

ArrowMessageMermaid
Synchronous call: the sender waits for the answerA->>B: call()
Asynchronous: the sender carries onA-)B: notify()
ReplyB-->>A: result
Sequence diagram with a synchronous call, an asynchronous message and a dashed reply
A student submits an essay: a call, an asynchronous notification and a reply. Rendered with Mermaid 11.17.2 from the code below.
sequenceDiagram
    actor Student
    participant Portal
    participant Mailer
    Student->>Portal: submit(essay)
    Portal-)Mailer: notifyTeacher()
    Portal-->>Student: receipt

How do you choose the arrows for a class diagram?

Use a school. Go through the pairs of classes and ask, for each pair, which sentence is true: is a kind of, implements, owns, has, or uses.

Step 1

Is a kind of: generalization

A student is a person and a teacher is a person. Two solid lines with hollow triangles at Person.

Step 2

Owns or has: composition or aggregation

A classroom cannot exist without its school, so School to Classroom is composition. A student still exists if the classroom is closed, so Classroom to Student is aggregation.

Step 3

Implements and uses: realization and dependency

Exam implements Gradable, a dashed line with a triangle. A teacher uses an exam only while marking it, a dashed open arrow.

School class diagram using generalization, composition, aggregation, realization and dependency
The school model with five kinds of arrow. Rendered with Mermaid 11.17.2 from the code below.
classDiagram
    direction LR
    class Person
    class Student
    class Teacher
    class School
    class Classroom
    class Gradable {
        <<interface>>
    }
    class Exam
    Person <|-- Student
    Person <|-- Teacher
    School *-- Classroom
    Classroom o-- Student
    Gradable <|.. Exam
    Teacher ..> Exam : marks

Draw this in the editor → Opens ChartCraft with this description filled in: “UML class diagram for a school: Student and Teacher inherit from Person, a School is composed of Classrooms, a Classroom aggregates Students, Exam implements the Gradable interface, and Teacher depends on Exam to mark it.”

Which UML arrow mistakes lose marks?

Direction mistakes are the most common, because the arrows point the opposite way from how many students say the sentence.

1. Inheritance triangle at the subclass

Loses marks

Wrong: the triangle points at Dog, so Animal inherits from Dog

Animal --|> Dog

Correct

Generalization (inheritance): a solid line with a hollow triangle pointing at the superclass Animal

Animal <|-- Dog

The triangle points at the parent. The wrong drawing says Animal is a kind of Dog.

2. Composition diamond at the part

Loses marks

Wrong: the filled diamond is at the Room end, so the room owns the house

Room *-- House

Correct

Composition: a filled diamond at the House end of the line to Room

House *-- Room

The diamond goes on the whole. The wrong drawing says a room owns a house.

3. Solid line to an interface

Loses marks

Wrong: a solid line with a triangle to an interface, which is inheritance, not realization

Payable <|-- Invoice

Correct

Realization: a dashed line with a hollow triangle pointing at the interface Payable

Payable <|.. Invoice

A class implements an interface: dashed line, hollow triangle. Solid is inheritance between classes.

Can you answer these five UML arrow questions?

Answer, then open the worked answer.

Question 1. A Car has an Engine that is thrown away with the car. Which arrow, and where is the diamond?

Worked answer

Composition: a filled diamond at Car.

Question 2. A Library has Books that can be moved to another library. Which arrow?

Worked answer

Aggregation: a hollow diamond at Library. The books exist on their own.

Question 3. What does a dashed line with a hollow triangle mean?

Worked answer

Realization: the class at the tail implements the interface at the triangle.

Question 4. A method of Report takes a Printer as a parameter and nothing more. Which arrow?

Worked answer

Dependency: a dashed line with an open arrowhead from Report to Printer.

Question 5. In a sequence diagram, what is a dashed arrow?

Worked answer

A reply message, the return from an earlier call.

Questions

What do UML arrows mean?

Each combination of line and end is one relationship: a hollow triangle is inheritance, a dashed hollow triangle realization, a dashed open arrow dependency, a plain line association, and diamonds aggregation (hollow) or composition (filled).

What are the UML class diagram arrow types?

Association, directed association, generalization, realization, dependency, aggregation and composition.

What are class diagram arrows?

The lines between class boxes. Their line style (solid or dashed) and end (arrowhead, triangle or diamond) say which relationship the classes have.

What does a dashed arrow mean in a UML class diagram?

A dependency when it has an open arrowhead, and realization of an interface when it has a hollow triangle.

What does a filled diamond mean in UML?

Composition: the class at the diamond owns the other, and the parts are destroyed with it.

Which way does the inheritance arrow point in UML?

From the subclass to the superclass. The hollow triangle touches the superclass.

Sources

The rules and names on this page were checked against these documents.

Related references

Describe the classes in plain English. ChartCraft picks the right arrow.

Class diagram generator →