You're designing an order processing system. The interviewer asks:
You start explaining: "First we validate the order, then check inventory... but wait, we also need to verify payment... and these can happen at the same time... then if inventory is low, we need to..."
The interviewer interrupts: "Can you draw the workflow?"
This is where Activity Diagrams come in.
An Activity Diagram models the workflow of a process, showing the sequence of activities, decision points, parallel execution, and the flow of control from start to finish.
While sequence diagrams show interactions between objects, activity diagrams show the flow of activities in a process, similar to a flowchart but with more power.
In this chapter, we'll cover:
An Activity Diagram is a UML diagram that visualizes:
Activity diagrams help you:
The starting point of the activity. Shown as a filled black circle.
Represents a single step or action in the process. Shown as a rounded rectangle.
The endpoint of the activity. Shown as a filled circle inside a circle (bullseye).
Terminates a specific flow without ending the entire activity. Shown as a circle with X.
A branching point where the flow takes different paths based on a condition. Shown as a diamond.
Brings multiple flows back together. Also shown as a diamond but with multiple incoming arrows.
Splits a single flow into multiple parallel flows. Shown as a thick horizontal bar.
Synchronizes multiple parallel flows back into one. Also a thick horizontal bar.
Activities execute one after another.
Flow takes different paths based on conditions.
Multiple activities execute simultaneously.
Activities repeat until a condition is met.
Swimlanes divide the diagram into columns or rows, showing who is responsible for each activity.
Benefits of Swimlanes:
What workflow are you modeling?
Write down every action that happens.
Where does the flow branch?
What can happen simultaneously?
Who does what? (for swimlanes)
Connect everything with proper flow.
Activity Diagrams model the workflow of a process, showing the sequence of activities, decision points, parallel execution, and control flow from start to finish.