Activity diagram

An activity diagram is UML's flowchart, with two additions that earn their keep: forks and joins for parallel work, and partitions for who does what.

It suits processes with genuine concurrency, which a plain flowchart handles badly.


#When to draw one

  • Processes with parallel steps that must all complete.

  • Algorithms and workflows with real branching.

  • Documentation where the swimlane and the flow both matter.


#What is on the diagram

Element

Meaning

Start and stop

Filled circle and bullseye

Action

A rounded box: ":do something;"

Decision

if/then/else, with guards in brackets

Fork and join

Parallel paths that all run and all must finish

Partition

A swimlane, written as a named block


#A worked example

A release process with parallel checks:

Activity diagram

The source, which you can paste into a new diagram and edit:

@startuml
|Engineering|
start
:Merge to main;
:Build artefact;
fork
  :Run unit tests;
fork again
  :Run integration tests;
fork again
  :Security scan;
end fork
if (All checks passed?) then (yes)
  |Release manager|
  :Deploy to staging;
  :Smoke test;
  if (Approved?) then (yes)
    :Deploy to production;
  else (no)
    :Roll back;
    stop
  endif
else (no)
  :Notify author;
  stop
endif
|Engineering|
:Monitor for 30 minutes;
stop
@enduml

#A few things that catch people out

  • A fork must be matched by a join. Parallel paths that never rejoin are a modelling error.

  • Guards belong in brackets on the branches, so the reader knows which path applies.

  • Partitions are the swimlanes. Use them when ownership matters, and leave them out when it does not.



Four types cover most of it.