PlantUML activity diagrams: branching to concurrent
Activity diagrams are often overlooked — they’re more powerful than flowcharts. This covers everything from basics to fork/join/exception handling.
Activity vs Flowchart
| Dimension | Flowchart | Activity diagram |
|---|---|---|
| Expresses | Data / control flow | Business activity / workflow / role collaboration |
| Role separation | None | partition / swimlane supported |
| Concurrency | Weak | Strong (fork / join) |
| Exceptions | Not really | Supported |
| UML standard | No | Yes |
The most basic activity diagram
1 | @startuml |
start/stopare start / end pseudo-states.:activity;is a single activity, rendered as a rounded rectangle.- Multiple activities run sequentially.
Decision nodes
The if (...) then (...) form:
1 | @startuml |
Multi-branch via switch:
1 | @startuml |
Loops
1 | @startuml |
PlantUML also has repeat / repeat while:
1 | @startuml |
The is (yes) not (no) decides which branch is true/false.
Concurrency: fork / join
The strongest activity-diagram feature:
1 | @startuml |
fork / fork again / end fork declares parallel branches.
Joining back:
1 | @startuml |
The activity after end fork runs only when all branches have completed.
Partitions (swimlanes)
Activities sorted by role — the killer activity-diagram feature:
1 | @startuml |
|role| switches to that swimlane. Activities are filed in the lane’s column.
Cleaner syntax for grouping:
1 | @startuml |
partition X { ... } keeps a group of activities in one lane.
Exception handling
PlantUML activity diagrams support exception paths:
1 | @startuml |
Multi-level if/else gets try/catch-like semantics.
If you want “any one fails → exit the whole flow,” use a fork + post-check:
1 | @startuml |
Real-world example
1 | @startuml |
Covers three creator paths (approve / revise / reject), four roles, full lifecycle in one image.
Review checklist
- Start / end clear — both
startandstoppresent? - Partitions clean — every role explicitly partitioned?
- fork / join balanced — every
forkmatched with anend fork? - Parallel branches truly independent?
- Exception paths marked?
- Retry loop has a clear termination?
Pitfalls
switchmust close withendswitch— missing one and the whole diagram fails silently.fork/end forkmust balance — missingend forkand downstream:activity;is unmoored.- Infinite loops — bare
whiledoesn’t terminate; always pair withif ... breakor userepeat ... is (yes) not (no). - Too many lane switches — switching roles every other line is unreadable. Use
partition X { ... }to group. - Long activity names get truncated — split into smaller steps.
vs sequence diagrams
| Scenario | Pick |
|---|---|
| One role working through a process | Activity |
| Multiple objects passing messages | Sequence |
| Business workflow (branches, exceptions, loops) | Activity |
| Specific API call sequence | Sequence |
They complement each other: activity describes the flow; sequence fills in the per-step object interactions.
vs BPMN
BPMN is the Business Process Model and Notation, purpose-built for workflows. PlantUML activity covers ~80% of BPMN’s core:
| BPMN | PlantUML |
|---|---|
| Task | :name; |
| Gateway (exclusive / parallel / inclusive) | if / fork / switch |
| Sequence flow | --> or implicit |
| Pool / lane | ` |
| Sub-process | partition X { ... } or note right of |
| Event (start / end / intermediate) | start / stop / (*) |
| Message flow | :send msg; + sync --> |
For non-strict workflows, activity is enough. For strict BPMN, use Camunda Modeler (or similar) and render back through PlantUML.
TL;DR
Activity diagrams are underused in PlantUML — fork/join/partition/exception support is real. Draw the flow first, the sequence diagram second; together they make a complete business document.
- Title: PlantUML activity diagrams: branching to concurrent
- Author: puml.online
- Created at : 2026-07-29 15:05:00
- Updated at : 2026-08-14 21:34:29
- Link: https://puml.online/blog/plantuml-activity-diagram-en/
- License: This work is licensed under CC BY-NC-SA 4.0.