Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 584
Adam Taylor Avatar asked Feb 08 '09 21:02

Adam Taylor


People also ask

How do you indicate a loop in UML?

The loop symbol has an appropriate representation in a construction consisting of four UML activity symbols - TASK, DECISION and two edges, where one edge leads from the TASK to DECISION and the other one leads backwards. The TASK represents the action and the decision node is used to resolve the loop condition.

What is call message in sequence diagram?

Call Message A message defines a particular communication between Lifelines of an Interaction. Call message is a kind of message that represents an invocation of operation of target lifeline.

How do you represent async call in sequence diagram?

Messages, written with horizontal arrows with the message name written above them, display interaction. Solid arrow heads represent synchronous calls, open arrow heads represent asynchronous messages, and dashed lines represent reply messages.


2 Answers

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 looplink to larger image (archived)

like image 102
joel.neely Avatar answered Sep 18 '22 00:09

joel.neely


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.

like image 33
Themelis Avatar answered Sep 18 '22 00:09

Themelis