Quel diagramme UML utiliser
Les quatorze types de diagrammes UML côte à côte, classés par la question à laquelle chacun répond - pour choisir en trente secondes au lieu de dessiner le mauvais diagramme pendant une heure.
9 min de lectureUML 2.5.13 sur 35
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.
| Element | Notation | What it means |
|---|---|---|
| What is it made of? | Class | Types, 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 case | Actors, goals and the system boundary. A use case diagram is a scope agreement, not a design. |
| What happens, in what order? | Sequence | Participants 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? | Deployment | Nodes, 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.
| Element | Notation | What it means |
|---|---|---|
| Class | Everyday | Types, attributes, operations and relationships. The one to learn first and the one you will draw most. |
| Object | Occasional | One snapshot of real instances. An object diagram is how you show that a confusing class diagram does in fact hold together. |
| Component | Common | Deployable units and the interfaces they provide and require. The component diagram is the closest UML gets to an architecture picture. |
| Deployment | Common | Nodes, artifacts, and which artifact is deployed onto which node. |
| Package | Occasional | Namespaces and the dependencies between them. A package diagram is how a cycle between modules becomes visible. |
| Composite structure | Rare | The internals of one classifier: parts, ports and connectors. Useful in embedded and systems work, rarely elsewhere. |
| Profile | Rare | How 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.
| Element | Notation | What it means |
|---|---|---|
| Use case | Common | Actors, goals and scope. Deliberately says nothing about how. |
| Activity | Everyday | Steps, branches, concurrency and responsibility. The activity diagramis UML's flowchart, with real semantics attached. |
| State machine | Common | The lifecycle of one object: states, events and transitions. A state machine earns its place the moment a status column exists. |
| Sequence | Everyday | Messages between participants, ordered down the page. |
| Communication | Occasional | The same interaction drawn as a network, with numbered messages. A communication diagram shows who talks to whom rather than when. |
| Timing | Rare | State against a time axis. A timing diagram is for when the deadline itself is the requirement. |
| Interaction overview | Rare | An 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.
| Element | Notation | What it means |
|---|---|---|
| A database schema | ER | Use an ER diagram in crow's foot notation. Tables and keys are not classes and operations. |
| A business process | BPMN | Use 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 landscape | ArchiMate | Use ArchiMate when the subject spans business, application and technology. UML has no vocabulary for a business capability. |
06What to remember
In one line each
- 01Write the question in one sentence first. The sentence picks the diagram; the catalogue never does.
- 02Structure diagrams answer what it is made of; behaviour diagrams answer what happens. A when in the question means behaviour.
- 03Four types carry most real work: class, sequence, activity and deployment.
- 04Activity is about work and responsibility; sequence is about messages and their order.
- 05If the subject is a schema, a business process or an enterprise landscape, the answer is ER, BPMN or ArchiMate rather than UML.
07Questions fréquentes
Quel diagramme UML est le plus utilisé en pratique ?
Le diagramme de classes, très largement, puis le diagramme de séquence. Ensemble ils couvrent l'essentiel des discussions de conception : de quoi le système est fait, et ce qui se passe à l'exécution. Viennent ensuite les cas d'utilisation et les activités, plutôt côté exigences que conception.
Quel diagramme UML montre le déroulement d'un processus ?
Le diagramme d'activité. Il a des actions, des décisions avec gardes, des barres de parallélisme et des couloirs pour la responsabilité : exactement le vocabulaire d'un processus. Prenez un diagramme de séquence quand l'important est qui envoie quel message.
Diagramme d'activité ou diagramme de séquence ?
Demandez de quoi parle le diagramme. S'il parle des étapes d'un processus et de qui en est responsable, prenez un diagramme d'activité. S'il parle des messages échangés entre participants précis et de leur ordre, prenez un diagramme de séquence. L'activité, c'est le travail ; la séquence, la conversation.
Quel diagramme UML montre la structure de la base de données ?
Aucun directement. Le diagramme de classes s'en approche et sert souvent de modèle de domaine, mais il décrit des types et des comportements, pas des tables et des clés. Pour un schéma, utilisez un diagramme entité-association en notation pied-de-corbeau, conçue pour cela.
Combien de diagrammes UML faut-il pour un système ?
Trois ou quatre en général, pas quatorze. Un diagramme de classes pour le domaine, un diagramme de séquence pour le ou les flux difficiles, et un diagramme de déploiement si l'infrastructure n'est pas évidente. Chaque diagramme de plus est un artefact de plus à garder vrai.
À lire aussi