Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Activity Diagrams
LLD

Activity Diagrams

Learn how to model workflows, decisions, parallel activities, and business processes using UML.

What It Models

Sequence diagrams track one scenario’s message order; activity diagrams model the workflow — branches, loops, parallel work — independent of which object does what. It is the flowchart of UML, used for business processes where control structure, not object interaction, is the complexity.

Anatomy

        ● start


 ┌─────────────┐     [refund approved]     ┌──────────────────┐
 │ Review      │──────────────────────────►│ Fork (sync bar)  │
 │ Refund Req  │                           └───┬──────────┬───┘
 └──────┬──────┘                               ▼          ▼
        │ [rejected]                    ┌─────────┐  ┌──────────┐
        ▼                               │Credit   │  │Email     │   PARALLEL
 ┌─────────────┐                        │original │  │customer  │   activities
 │ Notify user │                        │payment  │  │(swimlane:│
 └──────┬──────┘                        │method ◄─┼──┤NotifSvc) │
        │                               └────┬────┘  └────┬─────┘
        ▼                                    ▼            ▼
        ◉ end                          ┌────────Join bar───┐
                                       │ (wait for BOTH)    │
                                       └─────────┬──────────┘

                                            ◉ done
  • Rounded rectangles: activities. Diamonds: decisions with guard labels in brackets.
  • Thick bars: fork (one flow splits into concurrent flows) and join (all must finish before continuing).
  • Swimlanes (vertical columns when drawn full-width): assign each activity an owner role/system — accountability becomes visual.
  • ● / ◉: initial and final nodes.

Sync Bar Semantics

The fork bar is a real concurrency statement: after it, flows proceed independently; the join blocks until every incoming flow completes. In the refund example, crediting and emailing run concurrently; “done” fires only when both land. If instead email may fail independently, that path needs its own error branch — the diagram forces the designer to decide.

Activity vs Sequence vs State

QuestionDiagram
How do objects interact over one scenario?Sequence
What states can one entity live through?State machine
What’s the branching/parallel workflow logic?Activity

Interview Application

  • Best used verbally-plus-sketch for workflows with parallelism or policy branches: refunds, KYC verification, ride allocation.
  • Swimlanes answer “who owns this step?” disputes before they become API ownership disputes.
  • Drawing the fork unprompted when requirements say “notify user AND process credit” demonstrates completeness thinking.

Common Mistakes

  • Using activity diagrams for object interaction — no lifelines means message contracts stay unspecified.
  • Unbounded forks: spawning unbounded parallel flows without capacity thought; real systems need bounded executors behind every fork bar.
  • Missing final nodes → workflows with undefined completion semantics.

My Private Notes

Notes are auto-saved locally to this device.