Search code examples
umltransitionautomataplantuml

How to properly exit nested states in UML state diagrams?


I'm new at UML and I'm trying to document my software development process. I made the following diagram with PlantUML:

enter image description here

Within the inner states, I'd like to show that once their respective releases (i.e. minor/patch) are made, the next-highest level state should be returned to.

For example, after PatchRelease, Patch should exit to EvalStory. Ditto for MinorRelease --> EvalEpic. How should I show this? (An answer providing PlantUML code won't be necessary but would be nice)

[*] --> Major
state Major {
[*] --> CreateEpic
note right : An 'Epic' describes the set of desired\nfeatures the end-user would like to see
CreateEpic --> EvalEpic
EvalEpic --> Minor : unfulfilled
EvalEpic --> MajorRelease : fulfilled
MajorRelease --> [*]

state Minor {
[*] --> CreateStory
CreateStory --> EvalStory
EvalStory --> Patch : unfulfilled
EvalStory --> MinorRelease : fulfilled
MinorRelease --> DeployLive

state Patch {
[*] --> Testing
Testing --> DeployTest
DeployTest --> EvalTest
EvalTest --> Testing : bugs found
EvalTest --> PatchRelease: no bugs found

state Testing {
[*] --> WriteTests
WriteTests --> RunTests

RunTests --> WriteCode: test(s) failed
RunTests  -left-> WriteTests: tests passed
WriteCode --> RunTests
}
Patch --> EvalStory

}
Minor --> EvalEpic

}



}

Solution

  • For example, after PatchRelease, Patch should exit to EvalStory

    That is already happening, as that is the default behavior.

    Once PatchRelease has finished, there's nowhere else to go, so the Patch finishes its operation and then you can look at it again as if there were no states inside Patch.

    If you want to be explicit, you can

    1. add a final state after EvalStory, so a reader knows that you really meant to end there and it wasn't an accidental omission
    2. use entry/exit states; unfortunately PlantUML doesn't support those

    you can read on entry/exit states for example here http://www.uml-diagrams.org/state-machine-diagrams.html#exit-point-pseudostate