States, regions, and transitions

In UML modeling, states represent the changing behavior of an object. A change of state is described using a transition to show a path between two states.

States

A state can contain other states, often called as nested states or substates. If you are modeling complex state machines, use nested states to separate detailed behavior into multiple levels. States can also contain actions that identify the tasks that can occur when an object is in a particular state.

State types and regions

Every state is divided into compartments. The top compartment displays the name of the state. The compartment below the name compartment is the action compartment. The action compartment displays the do, entry, or exit activities that the state may contain. Each compartment below the activities compartment represents a region. State machines, composite states, and orthogonal states contain regions. A region can contain states, pseudostates, and transitions. Use regions to define nested states and transitions.
State type Description Diagram element
Simple A state with no regions The name of a simple state is displayed in the top compartment of a rectangle with rounded corners.
Composite A state with one region The name of a composite state is displayed in the top compartment of a rectangle with rounded corners.
Orthogonal A state with two or more regions The name of an orthogonal state is displayed in the top compartment of a rectangle with rounded corners.
Final A state that is placed in the region of a composite state to indicate that the activity in the region is complete The name of a final state is displayed below a circle that contains a solid circle.
Submachine state A state that references another state machine The name of a submachine state is displayed in the top compartment of a rectangle with rounded corners.

Transitions

A transition shows a path between states that indicates that a change of state is occurring. A trigger, a guard condition, and an effect are the three parts of a transition, all of which are optional.

A trigger is an event that must occur for a transition to start. A guard condition is a Boolean condition that must be true for a transition to occur. An effect is an action or activity that the object performs when a guard condition is satisfied.
Event type Description
Call An object receives a request to invoke an operation. The invocation of the operation triggers a transition.
Change A Boolean condition is specified that triggers a transition when the condition is true.
Signal A specified message that, when received by an object, triggers a transition.
Time A specified period of time that must pass or an absolute time that triggers a transition.

Feedback