Search code examples
databaseumlstatechart

UML Statechart Diagrams + Navigation Bar + Multiple exit actions


Hope all is well! I am making a UML statechart diagram for a website. If you have a navigation bar, would/can you have multiple exit actions representing each link?


Solution

  • It seems like there is only one exit behavior that can be defined (p. 307):

    14.2.3.4.3 State entry, exit, and doActivity Behaviors A State may have an associated entry Behavior. This Behavior, if defined, is executed whenever the State is entered through an external Transition. In addition, a State may also have an associated exit Behavior, which, if defined, is executed whenever the State is exited.

    Also in later passages they only talk of exit with singular. E.g.

    14.2.3.4.6 Exiting a State When exiting a State, regardless of whether it is simple or composite, the final step involved in the exit, after all other Behaviors associated with the exit are completed, is the execution of the exit Behavior of that State. If the State has a doActivity Behavior that is still executing when the State is exited, that Behavior is aborted before the exit Behavior commences execution.

    So you will need to test the state transition inside the exit behavior to take according actions.

    N.B. I'm using Enterprise Architect which allows definition of multiple exit behaviors. There is no way to define any guard which affirms my assumption about only a single exit to be allowed. So the implementation is likely broken here.