A State Machine Diagram in UML is a behavioral diagram that shows the sequence of states an object goes through during its lifetime in response to events.
State Machine representations in UML are based on the Harel State Chart Notation and therefore are sometimes referred to as State Charts.
When designing software systems, it’s often important to model how an object behaves over time and how it changes in response to events.
It shows states, transitions, triggers, and actions – how an object reacts to internal or external events during its lifetime.
State Machine diagrams excel at modeling systems with clear operational modes, such as user interfaces (login states, navigation flows), embedded systems (device operational states), business processes (order processing workflows), and protocol implementations (connection states in networking).
They’re particularly valuable for systems where the response to an event depends heavily on the current state, helping developers understand complex behavioral logic and identify potential issues like unreachable states or missing transitions.
Boolean expressions in square braces [] that must be True for a transition to be triggered. In the above example, a customer login must be successful in less than 3 attempts [Tries < 3], if not, the system login will be denied.
Actions can occur during transitions or within states. Transition actions execute when the transition fires, while state actions include entry, exit, and do activities.
Hierarchical States allow states to contain other states, creating nested state machines. This enables modeling complex behaviors where substates inherit transitions from their parent states.
This represent situations where an object can be in multiple states simultaneously, shown using dashed lines to separate concurrent regions.
Access our Beginner-friendly UML courses and step confidently into advanced Topics.
| UML Element Type | Icon in EA Toolbox | Description |
|---|---|---|
| State |
|
Represented by a rounded rectangle containing the state name. This is the fundamental building block where objects exhibit specific behavior or wait for events. |
| State Machine |
|
A State Machine element acts as a container for groups of related State elements. |
| Initial |
|
A filled black circle marking where the state machine begins execution. Each state machine must have exactly one initial state. |
| Final |
|
A circle containing a filled black circle, indicating successful completion or termination of the state machine. |
| History |
|
Shallow and Deep history are indicators that remember the last active substate when re-entering a composite state. |
| Synch |
|
A Synch state is useful for indicating that concurrent paths of a State Machine are synchronized. They are used to split and rejoin periods of parallel processing. |
| Object |
|
An Object is a particular instance of a Class at run time. |
| Choice |
|
A diamond shape representing a decision point where the transition path depends on guard conditions being evaluated. |
| Junction |
|
A filled black circle used to merge or split transition paths, helping to simplify complex transition logic. |
| Entry |
|
A small circle on the border of a composite state, providing a controlled entry mechanism into the state. |
| Exit |
|
A circle with an X, offering a defined exit mechanism from composite states. |
| Terminate |
|
An X symbol indicating abrupt termination of the state machine execution. |
| Fork/Join |
|
| UML Connector Type | Icon in EA Toolbox | Description |
|---|---|---|
| Transition |
|
States that a stereotype extends a UML metaclass (the «extends» relationship). |
| Object Flow |
|
Indicates inheritance between stereotypes so the child stereotype inherits the parent’s tags and rules. |
Get Sparx Systems Enterprise Architect and begin creating powerful UML package diagrams with ease. Buy EA Now!
Submit Your Request and We’ll Promptly Send a Payment link or Invoice.