3

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:

Break in an iterative expansion region with exit arrow

With no exit arrow:

Break in an iterative expansion region without exit arrow

With an end flow:

enter image description here

What is the correct convention ?

Jaroslav Kadlec
  • 2,505
  • 4
  • 32
  • 43
C0b0ll
  • 197
  • 1
  • 17

2 Answers2

1

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:

Expansion with break

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.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • The usage of exception could be a debat, do we use exception for real exception (real problem or unexpected event) or do we use exception to manage the logic ? It is a question, usually, in my company we use exception only in case of trouble. – granier Mar 08 '17 at 18:00
  • @granier You say it: it's debatable. Like so many things you can agree to domain specific conventions on how to use it. When looking at different languages you see that exceptions are used also in those two contexts. Some take them as "the usual way" to treat certain things while in other languages you have to swear to the bible before using it. – qwerty_so Mar 08 '17 at 23:03
-1

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.

Ted Johnson
  • 4,315
  • 3
  • 29
  • 31