The 6 UML Class Diagram Relationships

Engineer ExamUMLClass DiagramSoftware Engineering
Read in about 3 min read
Published: 2025-07-05
Last modified: 2025-07-21
View count: 72

Summary

Learn how to easily memorize the six types of UML class diagram relationships (Association, Dependency, Generalization, Realization, Composition, Aggregation) with a summary table. Includes short-answer questions for the engineer exam.

💡 Short-answer practice problems for the Information Processing Engineer exam are added as wrap-ups throughout the content. You can also review them along with final practice problems at the end of the post.

The six relationships in UML class diagrams are crucial for understanding software design, but their similar terms can be confusing at first. Grouping similar concepts together and summarizing them in a table helps you grasp and memorize them at a glance.

UML Class Diagram Relationships Summary Table

There are 6 relationships in total, consisting of 2 strong/weak has-a relationships (Composition/Aggregation), 2 strong/weak uses-a relationships (Association/Dependency), and 2 strong/weak is-a/can-do relationships (Generalization/Realization).

| Relationship | Core Concept | Diagram | Keywords | Simple Example | | :----------------- | :---------------------- | :------------------ | :--------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------- | ----------- | | Composition | Strong has-a | Filled Diamond | Shared Lifecycle, Essential Part | House and Room (If the house is destroyed, the room is also destroyed.) | | Aggregation | Weak has-a | Empty Diamond | Independent Lifecycle, Optional Part | Department and Student (Even if the department is closed, the student still exists.) | | Association | Strong uses-a | Solid Arrow | Member Variable, Lasting Relationship | Soccer Team and Striker (The soccer team always uses the striker.) | | Dependency | Weak uses-a | Dashed Arrow | Parameter, Brief Use | Developer and Book (The developer uses the book briefly.) | | Generalization | is-a (Inheritance) | Solid Hollow Arrow | Inheritance, Parent-Child | Cat is an Animal. (Animal is more general than a cat. Divided into superclass (Animal) and subclass (Cat), Animal < | -- Cat) | | Realization | can-do (Implementation) | Dashed Hollow Arrow | Interface, Fulfilling a contract | Robot can clean. (Grouped by the 'capability' to clean. 'Cleanable' < | .. 'Robot') |

ProblemList all the diamond relationships in a UML class diagram.
Your Answer
Correct AnswerReveal Answer
ProblemList all the arrow relationships in a UML class diagram.
Your Answer
Correct AnswerReveal Answer
ProblemList all the hollow arrow relationships in a UML class diagram.
Your Answer
Correct AnswerReveal Answer
ProblemList all six relationships in a UML class diagram.
Your Answer
Correct AnswerReveal Answer

Class Diagrams for Each Relationship

Composition

  • Keywords: Shared Lifecycle, Essential Part
  • Example: House and Room (If the house is destroyed, the room is also destroyed.)

Aggregation

  • Keywords: Independent Lifecycle, Optional Part
  • Example: Department and Student (Even if the department is closed, the student still exists.)

Association

  • Keywords: Member Variable, Lasting Relationship
  • Example: Soccer Team and Striker (The soccer team always uses the striker.)

Dependency

  • Keywords: Method Parameter, Brief Use
  • Example: Developer and Book (The developer uses the book briefly.)

Generalization

  • Keywords: Inheritance, Parent-Child
  • Example: A Cat is an Animal. (Animal is more general than a cat. Divided into superclass (Animal) and subclass (Cat), Animal <|-- Cat)

Realization

  • Keywords: Interface, Fulfilling a contract
  • Example: A Robot can clean. (Grouped by the 'capability' to clean. 'Cleanable' <|.. 'Robot')

Exam Preparation Problems

ProblemAmong UML relationships, which one represents a composition of several independent objects into one, is expressed by connecting an empty diamond from the part to the whole, and represents a relationship where one object contains another?
Your Answer
Correct AnswerReveal Answer
ProblemAmong UML relationships, which one is a permanent and strong relationship, expressed by connecting a filled diamond from the part to the whole? It is a special form of aggregation where a change in the whole object affects the part object.
Your Answer
Correct AnswerReveal Answer

Review Problems

ProblemList all the diamond relationships in a UML class diagram.
Your Answer
Correct AnswerReveal Answer
ProblemList all the arrow relationships in a UML class diagram.
Your Answer
Correct AnswerReveal Answer
ProblemList all the hollow arrow relationships in a UML class diagram.
Your Answer
Correct AnswerReveal Answer
ProblemList all six relationships in a UML class diagram.
Your Answer
Correct AnswerReveal Answer

Recommended Next Post