What is a State Diagram in UML?

What is a state diagram in UML?

A state diagram, sometimes knowns as a state machine diagram, is a type of behavioral diagram in the Unified Modeling Language (UML). It specializes in showing transitions between various objects.

You can build state diagrams, and many other types of UML diagrams, with Lucidchart’s premier chart-making technology. Never has diagramming been more simple or affordable.

Try it now
Sign up free

What is a State Diagram in UML?

State diagrams show the changing states of objects and help explain how and why those objects transform. Each state diagram typically begins with a dark circle that indicates the initial state and ends with a bordered circle that denotes the final state. However, despite having clear start and end points, it should be remembered that state diagrams are not necessarily the best tool for capturing an overall progression of events. Rather, they specialize in illustrating specific kinds of behavior—in particular, shifts from one state to another.

The main elements that state diagrams depict are states and transitions. States are captured by rectangles with rounded corners that are labeled with the name of the the state. Transitions are marked with arrows that flow from one state to another, showing how the states change. Below, you can see both these elements at work in a basic diagram for student life.

What is a state diagram in UML?

State Diagram Applications

Like most UML diagrams, state diagrams have several different uses. The main applications are as follows:

  • Depicting event-driven objects in a reactive system.
  • Illustrating use case scenarios in a business context.
  • Describing how an object moves through various states within its lifetime.
  • Showing the overall behavior of a state machine or the behavior of a related set of state machines.

STATE DIAGRAM COMPONENTS

Many different shapes can be included in a state diagram, particularly if you choose to combine it with another diagram. This list is a summary of the most common shapes you may encounter:

  • Composite state - a state that has substates nested into it.
  • Choice pseudostate - a diamond symbol that indicates a dynamic condition with branched potential results.
  • Exit point - the point at which a composite state or state machine is exited, denoted by a circle with an X through it.
  • Event - an instance that triggers a transition, labeled by name above the applicable transition arrow.
  • Final state - a marker for the first state in the process, shown by a dark circle with a transition arrow.
  • Guard - a Boolean condition that allows or stops a transition, written above the transition arrow.
  • State - a rectangle with rounded corners that indicates the current nature of an object.
  • Substate - a state contained within a composite state's region.
  • Transition - an arrow running from one state to another that indicates a changing state.
  • Transitional behavior - a kind of resulting behavior that happens as a state transitions, written above the transition arrow.
  • Trigger - a type of message that actively moves an object from state to state, written above the transition arrow.
What is a state diagram in UML?

Lucidchart is the perfect solution for producing seamless, readable diagrams for UML. Once you’ve transitioned, you’ll never want to use another editor again. We provide Visio import and export, so make the change now!

Try it now
Sign up free