How to represent communication with other object of the same class in UML sequence diagram?

809 views Asked by At

I have a question regarding UML sequence diagram. I have actor system, where I have many objects (actors) of the same class communicating with each other. The number of actors depends on the problem, but it is too large to draw them all. I have also other parts of a system (other actors) and now I'm drawing UML sequence diagram showing communication between actors with a time perspective. My question is how to show communication between actors of the same class?

I have found something like this:

enter image description here

But it looks like calling method within object and not other object of the same class (or maybe I'm wrong?). I also thought about showing two objects on diagram, but then I would have to double number of arrows, becouse each communication from other part of system would have to be connected with both. Do you know some third solution how to show this properly?

1

There are 1 answers

0
www.admiraalit.nl On

You could divide your scenario over multiple sequence diagrams.

One diagram has multiple lifelines for the same class, for example i1 : MyClass and i2 : MyClass and shows the interaction between the instances. If another part of the system calls method bar of all instances, then you could draw those calls, but what happens inside that method is modeled in a different sequence diagram.

For example, here is the first diagram:

seq1

and here is the second diagram:

seq2