| Subject: |
|
Re: difference between junction pseudostate and choice point |
| Name: |
|
Miro Samek |
| Date Posted: |
|
Jul 9, 08 - 3:03 PM |
| Email: |
|
miro@quantum-leaps.com |
| Website: |
|
http://www.quantum-leaps.com |
| Message: |
|
Section 15.3.8 in the "UML Superstructure Specification, v2.1.1" (document 07-02-05.pdf on the OMG website) specifies junction pseudostate and dynamic choice pseudostate as follows:
* junction vertices are semantic-free vertices that are used to chain together multiple transitions. They are used to construct compound transition paths between states. For example, a junction can be used to converge multiple incoming transitions into a single outgoing transition representing a shared transition path (this is known as a merge).
Conversely, they can be used to split an incoming transition into multiple outgoing transition segments with different guard conditions. This realizes a static conditional branch. (In the latter case, outgoing transitions whose guard conditions evaluate to false are disabled. A predefined guard denoted “else” may be defined for at most one outgoing transition. This transition is enabled if all the guards labeling the other transitions are false.) Static conditional branches are distinct from dynamic conditional branches that are realized by choice vertices (described below).
* choice vertices which, when reached, result in the dynamic evaluation of the guards of the triggers of its outgoing transitions. This realizes a dynamic conditional branch. It allows splitting of transitions into multiple outgoing paths such that the decision on which path to take may be a function of the results of prior actions performed in the same runto-
completion step. If more than one of the guards evaluates to true, an arbitrary one is selected. If none of the guards evaluates to true, then the model is considered ill-formed. (To avoid this, it is recommended to define one outgoing transition with the predefined “else” guard for every choice vertex.) Choice vertices should be distinguished from static
branch points that are based on junction points (described above).
I believe that the distinction between "junction" and "choice" could be significant for design automation tools, perhaps. However, when it comes down to actual coding state machines, the difference between "junction" and "choice" is academic. Both are coded as if (...) else if (...) ... else ...
The only difference I see is that dynamic choice allows some actions to be performed before evaluating the guards, so that the effect of the guards might depend on actions executed in the same RTC step.
In my state machines I use exclusively the more powerful "dynamic choice point", depicted as a diamond (see the Quantum Leaps Visio stencil at http://www.state-machine.com/resources/goodies.htm#Visio). The stencil does not even support the junction vertex anymore.
Miro |
|
|
|
|
|
|