📊

Overview of UML State Machine Diagrams

May 8, 2025

Lecture Notes: UML State Machine Diagrams

Introduction to UML State Machine Diagrams

  • UML State Machine Diagrams are used to represent the state transitions of entities in software.
  • Entities move from one state to another, capturing their lifecycle.
  • Example: A bank account can be suspended, active, closed, or under scrutiny.

Lifecycle Examples

  • Human Lifecycle: Birth, infancy, childhood, adolescence, youth, middle age, old age, infirmity, death.
  • Software systems often have non-linear state transitions.

Notation and Terms

  • Initial State: Where the state machine begins; multiple initial states are allowed.
  • Final State: Only one final pseudo state is allowed.
  • Comment or Note: Annotations in the diagram.
  • Decision: A gateway that leads to multiple paths.
  • State: Represents a condition or situation during the life of an object.
  • Composite State: Contains two or more substates.

Preparing a State Machine Diagram

  1. Identify business entities to be modeled.
  2. Identify various states of these entities.
  3. Identify transitions between states.
  4. Identify permanent states.

Case Study: Insurance System

  • Policy Lifecycle:
    • Proposal submitted âž” Underwriting team.
    • Policy issued and serviced by paying premiums.
    • Policy lapses if premiums are unpaid.
    • Lapsed or paid-up policies can be revived.
    • Upon death or contract completion, policy terminates, benefits are paid.
  • Additional Features:
    • Endowment plans can be pledged for loans.
    • Policy may be assigned to insurance companies and reassigned upon loan repayment.

Creating the State Machine Model

  • Start with initial state.
  • Use tools to choose UML state machine model.
  • Change design orientation if necessary.
  • Diagram states such as "being underwritten," "in force," "lapsed," "paid-up," and "terminated."
  • Identify transitions like policy revival.

Key States and Transitions

  • From "being underwritten" âž” "in force."
  • From "in force" âž” "lapsed."
  • Lapsed policies can become "paid-up" or "revived."
  • Policies can terminate from "lapsed," "paid-up," or "in force" states.

Composite States and Internal Behavior

  • Composite states have internal substates.
    • Example: "Applicant" state with substates "pending legal check" and "payment processing."
  • States can specify entry and exit points and conditions.

Conclusion

  • State machine diagrams are created early in the analysis phase.
  • Composite states and internal behaviors provide detailed control over transitions.

End of lecture notes.