Archyno
UMLGrundlagen

Welches UML-Diagramm verwenden?

Alle vierzehn UML-Diagrammtypen nebeneinander, sortiert nach der Frage, die jedes beantwortet - damit Sie in dreißig Sekunden wählen statt eine Stunde lang das falsche Diagramm zu zeichnen.

9 Min. LesezeitUML 2.5.13 von 35

What types exist,and how do they relate?Who uses it,and what for?What happens,in what order?What runswhere?Class diagramUse case diagramSequence diagramDeployment diagram
The four questions that account for most real diagrams, and the diagram each one wants.

01Start from the question, not the catalogue

Fourteen diagram types is a menu, and a menu is the wrong tool when you already know what you want to say. The reliable way in is to write down the question in one sentence and let the sentence pick the diagram. Almost every real question maps onto one of four.

ElementNotationWhat it means
What is it made of?ClassTypes, their attributes and how they relate. The class diagram is the default answer to any structural question and the one whose notation the rest borrow.
Who wants what from it?Use caseActors, goals and the system boundary. A use case diagram is a scope agreement, not a design.
What happens, in what order?SequenceParticipants and the messages between them, top to bottom. Reach for a sequence diagram when the order is the thing that is hard.
What runs where?DeploymentNodes, artifacts and the paths between them. The deployment diagram is what an infrastructure or security review actually needs.

The four questions that cover most work.

02The seven structure diagrams

A structure diagram shows what the system is made of, and nothing in it changes over time. All seven reuse class-diagram notation, so the cost of the sixth is far lower than the cost of the first.

ElementNotationWhat it means
ClassEverydayTypes, attributes, operations and relationships. The one to learn first and the one you will draw most.
ObjectOccasionalOne snapshot of real instances. An object diagram is how you show that a confusing class diagram does in fact hold together.
ComponentCommonDeployable units and the interfaces they provide and require. The component diagram is the closest UML gets to an architecture picture.
DeploymentCommonNodes, artifacts, and which artifact is deployed onto which node.
PackageOccasionalNamespaces and the dependencies between them. A package diagram is how a cycle between modules becomes visible.
Composite structureRareThe internals of one classifier: parts, ports and connectors. Useful in embedded and systems work, rarely elsewhere.
ProfileRareHow UML itself is extended - stereotypes and tagged values. You read a profile diagram far more often than you draw one.

03The seven behaviour diagrams

A behaviour diagram shows what happens, in what order and under what conditions. If your question has a when in it, you are here. Four of the seven are interaction diagrams, which differ mostly in what they put on which axis.

ElementNotationWhat it means
Use caseCommonActors, goals and scope. Deliberately says nothing about how.
ActivityEverydaySteps, branches, concurrency and responsibility. The activity diagramis UML's flowchart, with real semantics attached.
State machineCommonThe lifecycle of one object: states, events and transitions. A state machine earns its place the moment a status column exists.
SequenceEverydayMessages between participants, ordered down the page.
CommunicationOccasionalThe same interaction drawn as a network, with numbered messages. A communication diagram shows who talks to whom rather than when.
TimingRareState against a time axis. A timing diagram is for when the deadline itself is the requirement.
Interaction overviewRareAn activity diagram whose nodes are whole interactions - the index page for a set of sequence diagrams.

04The four that carry the load

Most teams draw four types and read a fifth. That is not a failure of ambition - it is what happens when every diagram has to be kept true. The other ten are worth being able to read when you meet one, which is a much smaller investment than being able to draw one cold.

Reach for it when

  • Class - the domain, once, kept current. The diagram most likely to still be true a year later.
  • Sequence - the one or two flows that are genuinely hard to explain in a paragraph.
  • Activity - a process crossing teams, where the swimlane is the whole point.
  • Deployment - any system whose infrastructure is not obvious from the repository.

Reach for something else when

  • Composite structure, unless you are doing embedded or systems engineering.
  • Timing, unless a deadline in milliseconds is part of the requirement.
  • Interaction overview, unless you already have several sequence diagrams to index.
  • Profile, unless you are extending UML itself rather than using it.

If you are learning rather than choosing, the order is the same: class first, because six of the structure diagrams reuse its notation; then sequence, because it is the one people ask for by name; then activity and use case, which are cheap once you can read a guard. The symbol reference covers the vocabulary all of them share.

05When the answer is not UML at all

Three questions look like UML questions and are not. Reaching for the wrong notation costs more than reaching for the wrong diagram, because the audience cannot read it either.

ElementNotationWhat it means
A database schemaERUse an ER diagram in crow's foot notation. Tables and keys are not classes and operations.
A business processBPMNUse BPMN when business analysts are the audience or the model is destined for an engine. An activity diagram is the right answer only when the audience is engineers.
An enterprise landscapeArchiMateUse ArchiMate when the subject spans business, application and technology. UML has no vocabulary for a business capability.

06What to remember

In one line each

  1. 01Write the question in one sentence first. The sentence picks the diagram; the catalogue never does.
  2. 02Structure diagrams answer what it is made of; behaviour diagrams answer what happens. A when in the question means behaviour.
  3. 03Four types carry most real work: class, sequence, activity and deployment.
  4. 04Activity is about work and responsibility; sequence is about messages and their order.
  5. 05If the subject is a schema, a business process or an enterprise landscape, the answer is ER, BPMN or ArchiMate rather than UML.

07Häufige Fragen

Welches UML-Diagramm wird in der Praxis am häufigsten verwendet?

Mit großem Abstand das Klassendiagramm, gefolgt vom Sequenzdiagramm. Zusammen decken sie die meisten Entwurfsgespräche ab: woraus das System besteht und was zur Laufzeit geschieht. Danach kommen Anwendungsfall- und Aktivitätsdiagramme, meist in der Anforderungsarbeit statt im Entwurf.

Welches UML-Diagramm zeigt den Ablauf eines Prozesses?

Das Aktivitätsdiagramm. Es hat Aktionen, Entscheidungen mit Wächtern, Verzweigungen für Nebenläufigkeit und Schwimmbahnen für Verantwortung - genau das Vokabular, das ein Prozess braucht. Ein Sequenzdiagramm nehmen Sie, wenn zählt, welcher Beteiligte welche Nachricht sendet.

Aktivitätsdiagramm oder Sequenzdiagramm?

Fragen Sie, wovon das Diagramm handelt. Geht es um die Schritte eines Prozesses und darum, wer für welchen zuständig ist, nehmen Sie ein Aktivitätsdiagramm. Geht es um Nachrichten zwischen konkreten Beteiligten und deren Reihenfolge, nehmen Sie ein Sequenzdiagramm. Aktivität ist Arbeit, Sequenz ist Gespräch.

Welches UML-Diagramm zeigt die Datenbankstruktur?

Direkt keines. Am nächsten kommt das Klassendiagramm, das oft für ein Domänenmodell dient, aber es beschreibt Typen und Verhalten statt Tabellen und Schlüssel. Für ein Schema nehmen Sie ein ER-Diagramm in Krähenfuß-Notation, die genau dafür entworfen wurde.

Wie viele UML-Diagramme braucht ein System?

Meist drei oder vier, nicht vierzehn. Ein Klassendiagramm für die Domäne, ein Sequenzdiagramm für die ein bis zwei schwierigen Abläufe und ein Verteilungsdiagramm, wenn die Infrastruktur nicht offensichtlich ist. Jedes weitere ist ein Artefakt mehr, das jemand wahr halten muss.

Alle Artikel