How to represent a call being made in a loop in a sequence diagram?

UmlSequence Diagram

Uml Problem Overview


I'm creating a sequence diagram, and one of the classes is being observed by another class. The observed class is calling update in the observer every 5 seconds in a loop. I need to show this in the sequence diagram. Is there a way to show it looping indefinitely out of sequence as it were?

Or does it not make sense in the context of a sequence diagram; should I not include it? Or should I include it in a different type of diagram?

Uml Solutions


Solution 1 - Uml

You can use a box enclosing the message send arrow (and whatever else is inside the same repetitive construct).

See this tutorial for an example.

sequence diagram with loop link to larger image (archived)

Solution 2 - Uml

Just adding a clearer picture because this one at @joel.tony's answer is damn blur.

enter image description here

As you can see the loop happens inside the frame called loop n. There is a guard, array_size, which controls the loop's iterations.

In conclusion the sequence of the messages inside the loop n frame (those between DataControl and DataSource objects) will happen array_size times.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAdam TaylorView Question on Stackoverflow
Solution 1 - Umljoel.neelyView Answer on Stackoverflow
Solution 2 - UmlThemelisView Answer on Stackoverflow