0

Can a transition have two or more actions?

For example:

       event[condition]/action1;action2
stateA -------------------------------------------> stateB
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
user1993478
  • 55
  • 1
  • 4

1 Answers1

1

Yes.

From Wikipedia:

In UML, a state transition can directly connect any two states. These two states, which may be composite, are designated as the main source and the main target of a transition. Figure 7 shows a simple transition example and explains the state roles in that transition. The UML specification prescribes that taking a state transition involves executing the following actions in the following sequence (see Section 15.3.14 in OMG Unified Modeling Language (OMG UML), Infrastructure Version 2.2):

  • Evaluate the guard condition associated with the transition and perform the following steps only if the guard evaluates to TRUE.
  • Exit the source state configuration.
  • Execute the actions associated with the transition.
  • Enter the target state configuration.

I have been unable to find succint wording to define this in the UML specification, but diagrams and further wording on the Wikipedia article (which is well-referenced) seem to imply that you should use ; as a separator, as in your example.

However, intuitively I would expect a system's state to change after each action has been taken, so (again intuitively) I would recommend minimizing your use of multiple actions per transition. Instead consider adding intermediate states.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055