admin管理员组

文章数量:1303032

How to represent the folowing workflow in a UML sequence diagram, using combined fragments for the do...while loop :

do
   Run script on server
   Correct errors
while (there are errors)

This is what I came up with for now, but I think I've actually represented an infinite loop:

I've checked this stackoverflow question but the accepted answer doesn't use combined fragments (which don't have cardinality, I think)...

How to represent the folowing workflow in a UML sequence diagram, using combined fragments for the do...while loop :

do
   Run script on server
   Correct errors
while (there are errors)

This is what I came up with for now, but I think I've actually represented an infinite loop:

I've checked this stackoverflow question but the accepted answer doesn't use combined fragments (which don't have cardinality, I think)...

Share edited Feb 15 at 18:22 Christophe 73.6k7 gold badges82 silver badges167 bronze badges asked Feb 10 at 21:58 Patrick B.Patrick B. 1,32911 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Both answers to the referred stackoverflow question suggest the use of a combined fragment with operator loop, and should answer the question. However, unfortunately, they do not illustrate the solution adequately among the alternatives considered. So let me explain it accordingingly:

The loop uses a guard that may be composed of boundaries regarding the number of iterations and/or a boolean expression.

The wording in the UML specs suggest that the loop is guaranteed to be executed the minimum number of time. The wording also suggests that the loop stops if the condition is false after the minimum number of iterations. Although there is a little ambiguity left, the wording suggests that the condition has no impact on the minimum number of iterations.

Here some graphical explanations of different cases possible, including the one corresponding structurally to do ... while:

Some people might misunderstand that the minimum number of iterations is only guaranteed if the guard is also true. This is not what is written in the UML specs but corresponds in good faith to the residual ambiguity. To avoid this, you can also use only a boolean expression, which can be in plain text:

本文标签: Represent dowhile loop in UML sequence diagram using combined fragmentStack Overflow