Activity Diagrams
Activity diagrams are essentially advanced flowcharts. They model the flow of control from one activity to another, supporting parallel behavior and complex logic.
1. Basic Symbols
- Start Node: A solid black circle.
- End Node: A bullseye (circle with a dot).
- Activity/Action: Rounded rectangle.
- Control Flow: Solid arrow.
2. Control Nodes
- Decision Diamond: One input, multiple outputs with [guards].
- Merge Diamond: Multiple inputs, one output (ends a decision).
- Fork (Split): A thick horizontal or vertical bar. One input splits into multiple parallel paths.
- Join: A thick bar where parallel paths merge back into one.
3. Swimlanes (Partitions)
Swimlanes group activities based on who performs them (e.g., “User”, “System”, “Database”).
4. Example: Order Processing
PlantUML Code:
|Customer|
start
:Place Order;
|Order System|
:Validate Order;
if (Order Valid?) then (yes)
fork
:Process Payment;
fork again
:Prepare Shipping;
end fork
:Ship Goods;
stop
else (no)
:Notify Error;
stop
endif
System Diagram
Decisions: Activity vs. State?
- Activity: Focuses on the flow of work (what happens). Use when describing a process/algorithm.
- State: Focuses on the lifecycle of an object (what it is). Use when an object’s behavior changes based on its current condition.