Skip to content

Latest commit

 

History

History
117 lines (95 loc) · 3.34 KB

File metadata and controls

117 lines (95 loc) · 3.34 KB

Experiment 4: Activity & State Chart Modeling

← Back to Index


Aim

To create Activity Diagrams and State Chart Diagrams for a given software system.


Theory

Activity Diagram

Models the workflow/flow of activities in a system — similar to a flowchart but supports parallel flows and multiple actors.

Element Symbol Description
Initial Node Filled black circle ● Start of activity
Final Node Circle with dot ⊙ End of activity
Activity Rounded rectangle A single step or task
Decision Diamond ◇ Conditional branching
Fork Thick horizontal bar Splits into parallel flows
Join Thick horizontal bar Merges parallel flows
Swimlane Vertical partition Shows which actor performs which activity

State Chart Diagram

Models the different states an object passes through during its lifetime and the transitions triggered by events.

Element Symbol Description
Initial State Filled circle ● Starting state
Final State Bull's eye ◎ End state
State Rounded rectangle A condition/situation of an object
Transition Arrow → Change from one state to another
Guard Condition [condition] Boolean expression controlling transition
Action / action Activity performed during transition

Procedure

For Activity Diagram:

  1. Identify the process or workflow to be modeled.
  2. List all activities, decision points, and parallel flows.
  3. Draw start node (filled circle) and end node (bull's eye).
  4. Connect activities using directed arrows.
  5. Add decision nodes (diamond) for conditional flows.
  6. Add fork/join bars for parallel activities.

For State Chart Diagram:

  1. Identify all possible states of the object.
  2. Identify events and conditions that cause state transitions.
  3. Draw states as rounded rectangles with state names.
  4. Connect states with labeled transition arrows.
  5. Add guard conditions [condition] where necessary.

Example

Activity Diagram: ATM Cash Withdrawal

          ●
          |
    [Insert Card]
          |
    [Verify PIN]
         / \
  [Invalid] [Valid]
      |         |
  [Retry?]  [Select Amount]
  /     \        |
[Yes]  [Block]  [Check Balance]
  |      |      /         \
  ↑      ⊙  [Insufficient] [Sufficient]
            |                  |
        [Show Error]    [Dispense Cash]
              |                |
              ⊙        [Print Receipt]
                               |
                               ⊙

State Chart Diagram: Order Processing System

[New Order]
     |
     | [Payment Received]
     ↓
[Confirmed]
     |
     | [Stock Verified & Dispatched]
     ↓
[Shipped]
     |
     | [Delivered to Customer]
     ↓
[Delivered]
     |
     | [Feedback Given / Time Elapsed]
     ↓
[Closed]

State Table: Order Object

Current State Event/Trigger Guard Condition Next State
New Payment received Amount ≥ order total Confirmed
Confirmed Dispatched Stock available Shipped
Shipped Delivery confirmed Customer signs Delivered
Delivered Time elapsed 7 days passed Closed
Any Cancel request Before shipment Cancelled