zhuang@linux:~/notes/software-design/uml-diagrams-overview/$ cat
UML Diagrams: An Overview
The Unified Modeling Language (UML) provides a standard set of diagrams for describing a system from different perspectives. UML 2.5 defines 14 diagram types, classified into structure diagrams and behavior diagrams. Interaction diagrams form a subset of behavior diagrams.
Classification
UML diagrams
├── Structure diagrams
│ ├── Class diagram
│ ├── Object diagram
│ ├── Component diagram
│ ├── Composite structure diagram
│ ├── Package diagram
│ ├── Deployment diagram
│ └── Profile diagram
└── Behavior diagrams
├── Use case diagram
├── Activity diagram
├── State machine diagram
└── Interaction diagrams
├── Sequence diagram
├── Communication diagram
├── Interaction overview diagram
└── Timing diagramThe two main categories answer different kinds of questions:
- Structure diagrams describe what the system is made of and how its elements are organized.
- Behavior diagrams describe what the system does and how it changes over time.
- Interaction diagrams focus specifically on communication between system elements.
Structure Diagrams
Structure diagrams present the static aspects of a system.
| Diagram | Overview |
|---|---|
| Class diagram | Shows classes, their features, and relationships. |
| Object diagram | Shows object instances and their links at a particular moment. |
| Component diagram | Shows software components and the dependencies between them. |
| Composite structure diagram | Shows the internal structure of a classifier and how its parts collaborate. |
| Package diagram | Shows how model elements are grouped into packages and how packages depend on one another. |
| Deployment diagram | Shows software artifacts deployed onto hardware or execution environments. |
| Profile diagram | Shows extensions that adapt UML to a particular domain or platform. |
Behavior Diagrams
Behavior diagrams present the dynamic aspects of a system.
| Diagram | Overview |
|---|---|
| Use case diagram | Shows system goals and the external actors that interact with the system. |
| Activity diagram | Shows workflows, actions, decisions, and concurrent flows. |
| State machine diagram | Shows the states of an element and the transitions between them. |
Interaction Diagrams
Interaction diagrams are behavior diagrams that describe how participants exchange messages.
| Diagram | Overview |
|---|---|
| Sequence diagram | Emphasizes the time-ordered exchange of messages. |
| Communication diagram | Emphasizes the links between participants that exchange messages. |
| Interaction overview diagram | Provides a high-level flow that coordinates other interactions. |
| Timing diagram | Emphasizes state or value changes along a time axis. |
Choosing a Category
Start with the question the model should answer:
- Use a structure diagram to describe organization, composition, or deployment.
- Use a behavior diagram to describe goals, workflows, or lifecycle changes.
- Use an interaction diagram to describe communication and message flow.
A system rarely needs every UML diagram. Choose only the diagrams that clarify the design for their intended audience.
References
- Object Management Group. OMG Unified Modeling Language (OMG UML), Version 2.5.1. 2017.
- Martin Fowler. UML Distilled: A Brief Guide to the Standard Object Modeling Language. 3rd ed., Addison-Wesley, 2003.
zhuang@linux:~/notes/software-design/uml-diagrams-overview/$ comments