UML Diagrams

Class Diagramsumlclasses, attributes, operations and relationships; the backbone of object-oriented design. Object Diagramsumla snapshot of concrete objects and their values at one moment. Package Diagramsumlmodules and namespaces and the dependencies between them. Component Diagramsumlreplaceable parts wired together through provided and required interfaces. Composite Structure Diagramsumlthe parts, ports and connectors inside one class or component. Deployment Diagramsumlnodes, containers and artifacts: where the software actually runs. Use Case Diagramsumlactors and the goals they achieve with the system. Activity Diagramsumlworkflows with decisions, parallel branches and swimlanes. State Machine Diagramsumlthe lifecycle of one object: states, events, guards. Sequence Diagramsumlmessages between participants ordered down a timeline. Communication Diagramsumlthe same messages numbered on links, emphasising who is connected. Timing Diagramsumlstate changes against a time axis with durations and deadlines. Interaction Overview Diagramsumlan activity-style flow whose steps are whole interactions.

The Unified Modeling Language (UML) is a standard visual vocabulary for software, maintained by the Object Management Group (OMG); the current version is UML 2.5.1. It defines 14 diagram types. You do not need all of them: most teams use four or five regularly. This section explains every type with notation legends, worked SVG examples, pros and cons, and diagrams-as-code source.


1. The Three Families

The 14 UML 2.5 Diagram Types UML Diagram Structure (7) Behavior (7) Class Object Package Component Composite Structure Deployment Profile Use Case Activity State Machine Interaction (4) Sequence Communication Timing Interaction Overview Structure = what the system is made of. Behavior = what it does. Interaction = who talks to whom, when.

UML diagrams split into two families. Structure diagrams show what the system is made of, independent of time: classes, objects, packages, components, internal parts and deployment nodes. Behavior diagrams show what the system does: use cases, activities and state machines. Inside behavior sits a third group, the interaction diagrams, which focus on messages exchanged between participants: sequence, communication, timing and interaction overview.

The seventh structure type, the profile diagram, is different from the others: it extends UML itself by defining stereotypes (such as «entity» or «microservice») and tagged values for a domain. It is used by tool builders and by standards such as SysML, so it has no separate page here.

2. How the Diagrams Fit Together

A typical design moves from outside in. Use case diagrams capture who needs what. Activity diagrams describe the business process behind each use case. Sequence diagrams then show how software participants collaborate to carry it out, and class diagrams define the types they need. State machines describe objects with lifecycles, such as an order or a payment. Finally, component and deployment diagrams show how the pieces are packaged and where they run.

The interaction diagrams are four views of the same kind of information. Sequence diagrams emphasise order, communication diagrams emphasise links, timing diagrams emphasise duration, and interaction overview diagrams tie many interactions into one flow. Pick the one that answers your current question; you can redraw a scenario in another form later.

In practice, sketches beat completeness. A diagram is worth drawing when it answers a question someone is actually asking, and worth keeping when it is cheap to update, which is why diagrams-as-code tools such as PlantUML and Mermaid are popular.

3. Which Diagram When

Question you need answeredDiagramTypical reader
What types exist and how are they related?ClassDevelopers
Does the model work on a real example?ObjectDevelopers, testers
How is the code organised; any cycles?PackageArchitects
What are the replaceable parts and their APIs?ComponentArchitects
What is inside this one component?Composite StructureDesigners
Where does it run and over which networks?DeploymentOps, SRE, security
Who uses the system and for what?Use CaseProduct, business
What are the steps of this process?ActivityAnalysts, developers
Which statuses can this object have?State MachineDevelopers, product
In what order do participants call each other?SequenceDevelopers
Which participants are coupled in this scenario?CommunicationDesigners
How long does each step take; are deadlines met?TimingPerformance, embedded
How do many scenarios fit together?Interaction OverviewArchitects

4. Further Reading