Ishan Saini
Ishan Saini

Reputation: 23

How to call complete internal flows multiple times in Sequence Diagrams

Main Idea: To convert an activity diagram into a sequence diagram.

Problem: I want that if "Action 2" fails then, in that case all the flows get triggered again from "Action 1".

(i.e Action 1 --> Action 2 --> then the verification again. and this should happen until Action 2 is Successful)

Basically, the flow works like a GOTO function and then from there triggers all the steps again.

I have tried to use a ref block but again it seems that it might be ambiguous and someone might read it only as the "execution of Action 1" and not the steps after it.

Therefore I wanted some hints to make this sort of scenario clear. Any suggestions would be appreciated.

Attaching the image for better clarity of the problem.

enter image description here

Upvotes: 2

Views: 1085

Answers (1)

Christophe
Christophe

Reputation: 73520

The activity and sequence diagrams are not supposed to be equivalent. Both set a different focus (flow vs interactions) and as a consequence you might have to do the mapping by identifying higher-level constructs.

Here you have clearly a loop:

enter image description here

You could reformulate in pseudocode as: REPEAT action 1 and action 2 UNTIL action 2 passes, which is a loop that has the test in the end. You could further rewrite this loop into: Last did not passed; WHILE last did not pass, DO action 1 and action 2, or WHILE true DO action 1 and action 2 and BREAk if it succeeds.

Now you can use a loop fragment to achieve this behavior in a sequence diagram. This fragment would enclose action1, action 2, and the test for success, and after the loop, would come the interaction for the success case. The nesting makes it very explicit what gets repeated and what not. For example, some variant of:

enter image description here

Upvotes: 1

Related Questions