Search code examples
umlstate-machine

UML local/external transition through multiple hierarchy levels


Can someone tell me how the depicted transitions work in UML, what entry exit transitions are executed? What's the order of execution, assuming the transitions have actions associated with them? Is this even legal in UML?

enter image description here


Solution

  • Yes it's legal.

    The order if you're doing it hierarchical is from outermost to innermost on Entry and from the innermost to the outermost on Exit. To make things more complicated, you need to understand, when do you actually leave the state.

    Let's have a look at two lines going from C to A.

    The first one goes up, out of A, then curves back and returns to A. This means you exit C, B, A and then enter A and that will be the execution order of the activities. Note, that if there is any activity on the transition itself, it will be executed between the activity upon exiting the A and the activity upon entering the A. So we have exit C, exit B, exit A, transition, entry A.

    The second line goes to the right, but stops at A border. It means, you never exit (nor re-enter) A. You do however exit C and then B and in that order would the exit activities be executed. If there is any transition activity, it will run last. So we have exit C, exit B, transition.

    The entry behaves in the opposite order (so respectively exit A, transition, entry A, entry B, entry D for curved and transition, entry B, entry D for straight)

    Finally the on starting on the Start pseudostate within B and going to C remains within B all the time, so the only activities will be transition, entry C.