I want to represent a break in an iterative expansion version in UML 2.4.1.
I tries this:
With exit arrow to the region:
With no exit arrow:
With an end flow:
What is the correct convention ?
I want to represent a break in an iterative expansion version in UML 2.4.1.
I tries this:
With exit arrow to the region:
With no exit arrow:
With an end flow:
What is the correct convention ?
There is no convention for it. It depends simply on what you want to say.
The first diagram is incorrect as Add
does not lead to any end. You need to connect it to wherever reasonable but not leave it stuck "in the air".
The second even more for twice the reason.
The third is the same as the first. You can use the Flow Final
instead of transferring control to the expansion node. You would do that if you have complex flows with many of such interim exits. For the simple case here you will not need it.
Please note that there is also a possibility to use a Initial
inside the region. You would use that if you have multiple inputs and want them to start at the same point inside.
P.S.: I overlooked your question while starring at the bugs in the diagram. The break condition can be shown by a guard in the transition which leads to a Flow Final
or connects to the output pin.
Alternatively, to interrupt processing all collection elements you get passed you can do this:
This treats the preemptive loop as an exception.
I would also say that a simple note would suffice unless you want to generate code from your model.
A bit down in Superstructures I found this:
When the ExpansionRegion completes all expansion executions, it offers the output collections on its output ExpansionNodes on any ActivityEdges outgoing from those nodes (they are not offered during the execution of the ExpansionRegion). If the ExpansionRegion contains an ActivityFinalNode immediately within it, then, if the ActivityFinalNode accepts a token within any expansion execution, all currently ongoing expansion executions are terminated and the ExpansionRegion as a whole completes its execution. In this case, output collections are still offered from the output ExpansionNodes, though the collections may only be partially filled.
Which confirms my first statement from the P.S.
Looking at the OMG UML spec:
First & Second Diagram:
Please refer to section 14.3.5 Examples which shows as I understand it that a state with no exit state is a terminal state for the submachine/composite state that contains it.
Third Diagram: You are saying aborted/terminate vs final state. Different things happen can happen. See page 338. I think you mean final state as expected, not in error, so avoid the circle with an X. Does not allow for normal execution to complete.
"terminate – Entering a terminate Pseudostate implies that the execution of the StateMachine is terminated immediately. The StateMachine does not exit any States nor does it perform any exit Behaviors. Any executing doActivity Behaviors are automatically aborted. Entering a terminate Pseudostate is equivalent to invoking a DestroyObjectAction."
Summary: It is subjective, but lines matter as behavior can be attached and they can be named. If we take the ATM examples (336-340)pg in the spec, they have been there for many UML versions, then I would say leaving it, if needed connecting it to an edge/exit point, or final state circle with a filled inner circle within the composite state <<iterative>>
. Now I am not sure what tool you are using, but that might be worth consideration. Not sure what the broader context is.