How to Draw a State Machine Diagram in UML?

A state machine Diagram (or start diagram, also called state chart of state transition diagram) is a behavior which specifies the sequence of states an  entity (or object) visits during its lifetime in response to events, together with its responses to those events.

State diagram at a glance

Key concepts

State

A state is a condition during the life of an object during which it satisfies some condition, performs some activity, or waits for some external event

Event

An event is the specification of a significant occurrence. For a state machine, an event is the occurrence of a stimulus that can trigger a state transition.

Transition

A transition is a relationship between two states indicating that an object in the first state will, when a specified set of events and conditions are satisfied, perform certain actions and enter the second state.

Action

An action is an executable, atomic (with reference to the state machine) computation. Actions may include operations, the creation or destruction of other objects, or the sending of signals to other objects (events).

Creating a State Machine Diagram

  1. Select Diagram > New from the tool bar.
    Create new diagram
  2. In the New Diagram window, select State Machine Diagram, then click Next. you can use the search bar above to filter results.
    Select State Machine
  3. Name the diagram, then click OK. In this tutorial, we will name the diagram State Machine Diagram Tutorial.
    name the diagram
  4. You will now see an empty diagram with an initial pseudo state.
  5. To Create a new state, click the initial state, then drag the resource button to the desire position and release. When release the button, choose Transition -> State from the popup window. Once the state is created, you may change the name of the state.
    New Stage
    Select Stage
  6. Repeat step 5 for more states.
  7. No you may see the transitions are not named. You can name a transition by double clicking the transition. This example will name the transition between Available and Locked to Lock.
    name Transition
  8. Once all the states are created, you may want to set up more transitions. You can do this by selecting Transition, click and hold on the starting state (Sold in this example), then drag to the destination state (Available in this example) and release. Do not forget to name the transition.
    More Transitions
  9. You are expected to see a diagram like this when you finish your diagram:

Turn every software project into a successful one.

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK