Use case diagrams: extend and include

Use case diagrams: extend and include

puml.online

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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@startuml
title Use case diagram: include vs extend

left to right direction

actor Customer as C
actor Support as S

rectangle "Order System" {
usecase "Place order" as PO
usecase "View order status" as VS
usecase "Validate stock" as ST
usecase "Apply coupon" as CP
usecase "Split shipment" as SP
}

C --> PO
C --> VS
S --> VS

PO ..> ST : <<include>>
CP ..> PO : <<extend>>
[if coupon code entered]
SP ..> PO : <<extend>>
[if multi-vendor order]

note right of PO
include = always executed
extend = executed only under a condition
end note
@enduml

The key points:

  • usecase "name" as Alias declares a use case, actor Name as Alias declares a participant, and rectangle "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 PO attaches a note to a use case; <<include>> works inside the note too.
  • Participants can inherit as well: actor Admin --|> Customer gives 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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
flowchart LR
C(["Customer"])
S(["Support"])

subgraph SYS["Order System"]
PO["Place order"]
VS["View order status"]
ST["Validate stock"]
CP["Apply coupon"]
SP["Split shipment"]
end

C --> PO
C --> VS
S --> VS

PO -. "include" .-> ST
CP -. "extend" .-> PO
SP -. "extend" .-> PO

What the Mermaid version has to do:

  • subgraph SYS["Order System"] { ... } plays the role of PlantUML’s rectangle boundary.
  • 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
2
flowchart LR
PO["Place order"] -. "<<include>>" .-> ST["Validate stock"]

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
2
flowchart LR
PO["Place order"] -. "&lt;&lt;include&gt;&gt;" .-> ST["Validate stock"]

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 &lt;&lt;include&gt;&gt;
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.
On this page
Use case diagrams: extend and include