Activity Diagrams
Actions, decisions, merges, forks and joins, start and end nodes, object flows and swimlanes - how to draw the steps of a process and who does them.
An activity diagram shows the steps of a process in the order they happen: what is done, where the path splits on a condition, which steps run in parallel, and — with swimlanes — who does each step. It is the UML cousin of the flowchart, and it is the natural next picture after a use case: the use case names the goal, the activity diagram walks through how it is reached.
The notation
| Element | Drawn as | Means |
|---|---|---|
| Action | A rectangle with rounded corners | One step of work, named as a verb phrase |
| Initial node | A small filled circle | Where the activity starts |
| Activity final node | A bull's-eye (a filled circle inside a ring) | The whole activity ends here |
| Flow final node | A circle with an X | Only this flow ends; the others go on |
| Decision | A diamond, one flow in, several guarded out | Exactly one way out is taken, the one whose guard holds |
| Merge | A diamond, several flows in, one out | Alternative paths meet again (no waiting) |
| Fork | A thick bar, one flow in, several out | The outgoing flows start in parallel |
| Join | A thick bar, several flows in, one out | Wait until every incoming flow has arrived |
| Object node | A rectangle with a name and an optional state | Data passed between actions, e.g. Order [placed] |
| Control flow | A solid arrow, optionally with a [guard] | The order of the steps |
| Object flow | A solid arrow into or out of an object node | Data produced by one action and used by another |
| Swimlane | A named column (an activity partition) | The steps inside it are done by that participant |
Think of a token moving along the arrows. The initial node offers one token; an action starts when a token arrives and passes one on when it finishes. A decision sends the token down exactly one guarded flow; a fork copies it onto every outgoing flow; a join waits for a token on every incoming flow before it lets one through.
Decisions and guards
Every flow out of a decision carries a guard in square brackets — a condition that must be true for the token to take that flow. The guards of one decision should cover every case and never overlap; [else] is the conventional catch-all.
(Search the catalogue) --> <decision>
<decision> --[book available]--> (Issue the loan) --> <merge>
<decision> --[else]-----------> (Place a reservation) --> <merge>
<merge> --> (Send confirmation) --> (◉ activity final)The merge after the two branches is not decoration. Without it, Send confirmation would have two incoming flows, and an action with several incoming flows waits for all of them — a join in disguise that never fires, because only one branch ever runs.
Parallel flows
Draw a fork when steps can happen at the same time — pack the items while the invoice is sent — and a join where the process must wait for all of them. Forks and joins usually come in pairs. The exception is a branch that simply ends: give it a flow final node, which stops only that flow. An activity final node stops the whole activity, including any flows still running, so it belongs at the very end.
Object flows
When the thing passed between steps matters, show it as an object node: Place order produces an Order [placed], which Process order consumes. The arrows into and out of an object node are object flows. The state in brackets is optional, and it is a good way to show an object's life — the same Order can appear as [placed], [paid] and [shipped] further down.
Swimlanes
Swimlanes (UML calls them activity partitions) divide the diagram into columns, one per participant — a role, a department or a system. Each action sits in the lane of whoever performs it, so responsibilities are visible at a glance, and every arrow that crosses a lane boundary is a hand-off between participants. In DiaGO a node belongs to the lane it is placed or dropped in, and moving or reordering a lane moves its nodes with it.
Reach for it
- Walking through the steps of a use case or business process
- Showing where a process branches, loops or runs steps in parallel
- Making hand-offs between people, departments or systems visible with swimlanes
Avoid it
- Showing which objects call which operations - use a sequence diagram
- Showing the structure of the system - use a class or component diagram
- Modelling every line of an algorithm - keep actions at the level of meaningful steps
Common mistakes
No start, or several. By convention an activity has one initial node. UML allows several, each starting its own flow, but if two things begin at once it is clearer to start once and fork.
Flows out of a final node. Nothing continues after an activity final or a flow final. If the path should go on, it was not the end.
Unguarded or overlapping branches. A decision with [amount > 100] and an unguarded second flow says nothing about when the second is taken. Guard every branch, and use [else] for the rest.
Branches that meet at an action. Two flows drawn straight into one action make it wait for both. Bring alternative branches together at a merge, and parallel ones at a join, then draw one flow into the action.
Unbalanced forks and joins. A fork whose parallel flows never meet at a join (or end at flow finals) leaves the reader guessing whether the process waits for them.
Actions named as nouns. Invoice is an object; Send invoice is an action. Name actions after what is done.
Practice
Draw how a library member borrows a book: search the catalogue, then decide — if the book is available, issue the loan; otherwise place a reservation — and merge before sending a confirmation. Then add three swimlanes, Member, Library system and Librarian, and move each action into the lane of whoever does it.