Use case diagrams: extend and include
Introduction
<<include>> and <<extend>> are the most-confused pair of stereotypes in a use case diagram. Both are drawn as a dashed dependency arrow with a similar-looking label, but their meanings are close to opposite: one is a reuse that always happens, the other an extension that happens only under a condition. Getting them backwards raises no error, and at review time nobody may notice — but the reader ends up with the exact opposite conclusion.
The test is one sentence: can the base use case stand on its own?
- No — the other use case is required for the base to be complete (placing an order must validate stock first). That is
<<include>>. - Yes — the base use case is complete by itself, it just sometimes does one extra thing (apply a coupon when a code was entered). That is
<<extend>>.
The arrow direction matters too, and the two are opposite: <<include>> points from the use case that reuses to the use case that is reused; <<extend>> points from the extending use case to the extended base use case.
PlantUML supports both stereotypes natively — <<include>> and <<extend>> go straight on the edge label, and <<extend>> can carry a condition. Mermaid has no use case diagram type at all, so a flowchart has to stand in — and it has a sharp edge around <<>> that this post walks through.
PlantUML
PlantUML is a native use case diagram engine: usecase, actor, the system boundary, and both stereotypes are first-class citizens:
1 | @startuml |
The key points:
usecase "name" as Aliasdeclares a use case,actor Name as Aliasdeclares a participant, andrectangle "Order System" { ... }is the system boundary.- Participant-to-use-case links are solid
-->(interaction); use-case-to-use-case links are dashed..>(dependency). PO ..> ST : <<include>>— “Place order” always invokes “Validate stock”, and the arrow points at the included use case.CP ..> PO : <<extend>>— “Apply coupon” extends “Place order”, and the arrow points at the extended base use case, the opposite direction from include.- The condition goes on the next line in square brackets:
[if coupon code entered]. That is the UML constraint syntax, and PlantUML lays it out as an extra note under the label. note right of POattaches a note to a use case;<<include>>works inside the note too.- Participants can inherit as well:
actor Admin --|> Customergives the admin every use case the customer has.
Mermaid
Mermaid has no use case diagram type, so a flowchart has to stand in. The system boundary becomes a subgraph, participants become rounded nodes, and use cases become rectangles:
1 | flowchart LR |
What the Mermaid version has to do:
subgraph SYS["Order System"] { ... }plays the role of PlantUML’srectangleboundary.- Participants are
(["Customer"])(a stadium shape), use cases are["Place order"](a rectangle). The shapes are a convention — Mermaid will not hold you to them. - Participant-to-use-case links are solid
-->, use-case-to-use-case links are dashed with a label:-. "include" .->. - There is no separate syntax for a condition, so it has to go inside the edge label:
-. "extend (if coupon)" .->.
Here is a real trap. If you write <<include>> directly:
1 | flowchart LR |
Mermaid parses it as an HTML tag, and all that survives on the diagram is an empty <> — the word “include” is silently gone. Nothing throws, the diagram still renders, and it is very easy to miss. To keep the UML stereotype intact, escape it as an entity:
1 | flowchart LR |
That renders as a full <<include>>. If you want the simpler route, just write the words include / extend — the meaning stays perfectly clear and there is nothing to escape.
Side by side
| Aspect | PlantUML | Mermaid |
|---|---|---|
| Diagram type | Native use case diagram (usecase / actor) |
Generic flowchart (flowchart) emulation |
| Include relation | PO ..> ST : <<include>> |
PO -. "include" .-> ST |
| Extend relation & direction | CP ..> PO : <<extend>>, arrow at the base use case |
CP -. "extend" .-> PO, direction by convention |
| Conditions | Next line: [if coupon code entered] |
Has to go inside the edge label |
| Raw stereotype text | <<include>> renders as written |
Bare <<...>> becomes <>; use <<include>> |
| Semantic checking | The engine knows both stereotypes | Entirely down to whoever drew it |
Wrap-up
Choosing between include and extend comes down to asking whether the base use case can stand alone, then confirming the arrow: include points at the reused use case, extend points at the extended base use case. PlantUML supports both natively and keeps the condition on its own line; Mermaid can only emulate it with flowchart, where shapes, direction, and the meaning of the label are all conventions you have to hold to yourself — plus the <<>> trap that eats the word.
The two diagrams actually carry the same amount of information. The difference is not the engine — it is whether you made “always happens” and “happens under a condition” explicit.
- Title: Use case diagrams: extend and include
- Author: puml.online
- Created at : 2026-12-06 01:00:00
- Updated at : 2026-12-06 10:29:22
- Link: https://puml.online/en/blog/use-case-diagram-extend-include/
- License: This work is licensed under CC BY-NC-SA 4.0.