Skip to content

Activity Diagrams

Activity diagrams show the flow of control or data through a system. They’re great for documenting business processes and algorithms.

Basic Flow

PlantUML Diagram

Conditional Flow

PlantUML Diagram

Complex Business Process

Error generating PlantUML diagram: Request failed with status code 520

@startuml
!theme plain

start
:Receive application;

:Initial review;
note right: Check completeness

if (Complete?) then (yes)
  :Technical evaluation;
  
  if (Meets requirements?) then (yes)
    :Schedule interview;
    :Conduct interview;
    
    if (Approved?) then (yes)
      :Make offer;
      
      if (Offer accepted?) then (yes)
        :Onboarding process;
        #palegreen:New hire starts;
      else (no)
        #pink:Close position;
      endif
    else (no)
      :Send rejection;
    endif
  else (no)
    :Send rejection;
  endif
else (no)
  :Request missing info;
  
  if (Info received?) then (yes)
    :Return to review;
  else (no, timeout)
    #pink:Archive application;
  endif
endif

stop
@enduml

Swimlane Activity Diagram

Error generating PlantUML diagram: Request failed with status code 520

@startuml
|Customer|
start
:Browse products;
:Add to cart;
:Checkout;

|System|
:Validate cart;
:Calculate total;
:Process payment;

|Warehouse|
:Check inventory;
:Pick items;
:Pack order;

|Shipping|
:Generate label;
:Dispatch order;
:Deliver to customer;

|Customer|
:Receive order;
:Confirm delivery;

stop
@enduml

Error Handling Flow

Error generating PlantUML diagram: Request failed with status code 520

@startuml
start
:Open file;

if (File exists?) then (yes)
  :Read content;
  
  if (Valid format?) then (yes)
    :Parse data;
    
    if (Parse successful?) then (yes)
      :Process data;
      :Save results;
      #palegreen:Success;
    else (no)
      #pink:Log parse error;
      :Show error to user;
    endif
  else (no)
    #pink:Log format error;
    :Show format error;
  endif
else (no)
  #pink:File not found;
  :Create default file;
endif

stop
@enduml

Parallel Processing

Error generating PlantUML diagram: Request failed with status code 520

@startuml
start

:Initialize system;

fork
  :Load user data;
  :Validate permissions;
fork again
  :Load configuration;
  :Check licenses;
fork again
  :Connect to database;
  :Verify schema;
end fork

:System ready;

partition "Main Process" {
  :Process requests;
  while (More requests?) is (yes)
    :Handle request;
  endwhile (no)
}

:Shutdown;
stop
@enduml

Best Practices

  1. Use colors: Highlight important states with colors
  2. Add notes: Provide context for complex decisions
  3. Use swimlanes: Show responsibility across different actors
  4. Keep it simple: Don’t overcomplicate with too many branches
  5. Label decisions clearly: Make yes/no paths obvious