Labs ICT
⭐ Pro Login

Activity Diagrams

Modeling workflows and business processes with activity diagrams.

What is an Activity Diagram?

An Activity Diagram is a UML diagram that models the flow of control or data from one activity to another. It's essentially a sophisticated flowchart that can show concurrency, decision making, and parallel processing. Activity diagrams are great for modeling business processes, workflows, and algorithms.

Unlike sequence diagrams (which focus on object interactions), activity diagrams focus on the activities or actions that happen β€” who or what performs them is less important than what happens and in what order.

Activity Diagram Notation

Basic Elements:

1. Initial Node (solid circle)
   ●

2. Activity Final Node (solid circle with ring)
   β—‰

3. Action (rounded rectangle)
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   Action Name      β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

4. Decision Node (diamond with incoming/outgoing arrows)
   β—‡
   β†’ outgoing edges have [guard conditions]

5. Merge Node (diamond with multiple incoming, one outgoing)
   β—‡

6. Fork Node (horizontal bar β€” splits flow into parallel)
   ═══════

7. Join Node (horizontal bar β€” merges parallel flows)
   ═══════

8. Swimlanes (vertical/horizontal partitions)
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Actor1 β”‚ Actor2 β”‚ Actor3 β”‚
   β”‚        β”‚        β”‚        β”‚

Example: Order Processing Workflow

Order Processing Activity Diagram:

  ●
  β”‚
  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Receive Order   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Validate Items   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
        β—‡
       β•± β•²
      β•±   β•²
[valid]  [invalid]
    β•±        β•²
   β–Ό          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Process  β”‚  β”‚ Notify       β”‚
β”‚ Payment  β”‚  β”‚ Customer     β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚               β”‚
     β–Ό               β”‚
    β—‡                β”‚
   β•± β•²               β”‚
  β•±   β•²              β”‚
[paid] [failed]      β”‚
  β•±      β•²           β”‚
 β–Ό        β–Ό          β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”   β”‚
β”‚ Ship  β”‚ β”‚Refundβ”‚   β”‚
β”‚ Order β”‚ β”‚      β”‚   β”‚
β””β”€β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”˜   β”‚
    β”‚        β”‚       β”‚
    β–Ό        β–Ό       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  Send Receipt    β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
         β”‚           β”‚
         β–Ό           β”‚
        β—‰            β”‚
         β•²           β”‚
          β•²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Swimlanes (Partitions)

Swimlanes divide activities by who or what performs them. They add accountability and clarity to complex workflows:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Customer β”‚ System   β”‚ Payment  β”‚ Warehouseβ”‚
β”‚          β”‚          β”‚ Gateway  β”‚          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚          β”‚          β”‚          β”‚          β”‚
β”‚ Browse   β”‚          β”‚          β”‚          β”‚
β”‚ items    β”‚          β”‚          β”‚          β”‚
β”‚    β”‚     β”‚          β”‚          β”‚          β”‚
β”‚    β–Ό     β”‚          β”‚          β”‚          β”‚
β”‚ Add to   β”‚          β”‚          β”‚          β”‚
β”‚ cart     β”‚          β”‚          β”‚          β”‚
β”‚    β”‚     β”‚          β”‚          β”‚          β”‚
β”‚    β–Ό     β”‚          β”‚          β”‚          β”‚
β”‚ Checkout β”‚          β”‚          β”‚          β”‚
β”‚    β”‚     β”‚          β”‚          β”‚          β”‚
β”‚    β–Ό     β”‚          β”‚          β”‚          β”‚
β”‚          β”‚ Validate β”‚          β”‚          β”‚
β”‚          β”‚ order    β”‚          β”‚          β”‚
β”‚          β”‚    β”‚     β”‚          β”‚          β”‚
β”‚          β”‚    β–Ό     β”‚          β”‚          β”‚
β”‚          │──────────▢          β”‚          β”‚
β”‚          β”‚          β”‚ Process  β”‚          β”‚
β”‚          β”‚          β”‚ payment  β”‚          β”‚
β”‚          β”‚          β”‚    β”‚     β”‚          β”‚
β”‚          │◀──────────│    β”‚     β”‚          β”‚
β”‚          β”‚          β”‚          β”‚          β”‚
β”‚          │─────────────────────▢          β”‚
β”‚          β”‚          β”‚          β”‚ Pick &   β”‚
β”‚          β”‚          β”‚          β”‚ pack     β”‚
β”‚          β”‚          β”‚          β”‚ items    β”‚
β”‚          β”‚          β”‚          β”‚    β”‚     β”‚
β”‚          │◀─────────────────────│    β”‚     β”‚
β”‚          β”‚          β”‚          β”‚          β”‚
β”‚ Receive  β”‚          β”‚          β”‚          β”‚
β”‚ package  β”‚          β”‚          β”‚          β”‚
β”‚          β”‚          β”‚          β”‚          β”‚

Fork and Join β€” Parallel Activities

Fork nodes split a single flow into multiple parallel flows. Join nodes wait for all parallel flows to complete before continuing:

Fork and Join Example:

         ═══════  ← Fork (split into 3 parallel flows)
        β•±    β”‚    β•²
       β–Ό     β–Ό     β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Send   β”‚ β”‚ Update β”‚ β”‚ Notify β”‚
  β”‚ Email  β”‚ β”‚ Stock  β”‚ β”‚ Admin  β”‚
  β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
      β”‚          β”‚          β”‚
      ═══════  ← Join (wait for all 3 to complete)
         β”‚
         β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Order Completeβ”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

All three actions happen in parallel.
The flow continues only after ALL three complete.

Activity Diagram vs Flowchart

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Feature             β”‚ Activity Diagram               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Notation            β”‚ UML standard                   β”‚
β”‚ Swimlanes           β”‚ Built-in support               β”‚
β”‚ Parallel processing β”‚ Fork/Join nodes                β”‚
β”‚ Object flow         β”‚ Can show data passing          β”‚
β”‚ Exceptions          β”‚ Exception handlers supported   β”‚
β”‚ Partitioning        β”‚ By actor/system/responsibility β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

When to use:
  β€’ Modeling business processes β†’ Activity Diagram
  β€’ Simple algorithm logic β†’ Flowchart is fine
  β€’ Complex workflows with parallel steps β†’ Activity Diagram
  β€’ Quick sketch for communication β†’ Flowchart is fine

πŸ§ͺ Quick Quiz

What is an activity diagram used for?