3

This is not a problem but more of a fundamental question, that I know will have been implemented differently by each of the tool suppliers, so I want what people believe to be the intended behaviour by the OMG UML/SysML working groups.

In the following image of a complex state, and I know there are a lot of untriggered and only guarded transitions. Is the do behaviour of the state Motion::Active::Debounce trigger if the guard on the exiting transition is true before the entry behaviour is completed?

enter image description here

Or, would you model this in a different manner?

1 Answers1

1

The UML 2.5.1 spec states on p. 309:

14.2.3.4.3 State entry, exit, and doActivity Behaviors

[...]

A State may also have an associated doActivity Behavior. This Behavior commences execution when the State is entered (but only after the State entry Behavior has completed) and executes concurrently with any other Behaviors that may be associated with the State, until:

  • it completes (in which case a completion event is generated) or
  • the State is exited, in which case execution of the doActivity Behavior is aborted.

The execution of a doActivity Behavior of a State is not affected by the firing of an internal Transition of that State.

So: the doActivity will be triggered but aborted immediately since the exit condition is true. In other words: it will not run.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • Specs "commences execution when the State is entered (but only after the State entry Behavior has completed)" vs narrative "if the guard on the exiting transition is true before the entry behaviour is completed". Doesn't this mean that the do behavior is not even started in this situation? – Christophe Aug 08 '23 at 16:35
  • @Christophe Well, that's what I said. I you shoot the sprinter at the start he's not really running a millimeter. I amended the last sentence. – qwerty_so Aug 08 '23 at 18:06
  • The emphasis wad on "(but only after state entry behavior has completed)". Let me reformulate the question: isn't the entry activity aborted if the exit conditions are met? (i.e. then the entry behavior would never complete and hence the do would never start - which I agree, is very similar to your conclusion, although with a slightly different reasoning). – Christophe Aug 08 '23 at 18:39
  • @Christophe No, the entry is completed. Only the doActivity is aborted. The OP asked about the latter. – qwerty_so Aug 08 '23 at 18:49
  • Ok! Now I get it ! Thanks :) – Christophe Aug 08 '23 at 19:33
  • Thank you both, these little discussions are always helpful, but also highlights where there are edge cases cause questions. – Daniel Ashby Aug 14 '23 at 14:18