How to draw calls from designers in UML sequence diagrams?

I saw several ways of drawing constructors, namely here with tails below them (function call), but most often here without tails and without returning the arrow (sometimes with the <<create>> label).

I know that there are differences between UML1 and UML2, and I'm not sure if this is one of them, however, in any case, I cannot find references to how I can represent method calls from the constructor of an object.

EDIT: example java code below. Say the entry point is foo() . The main thing that interests me is how to draw the constructor of B() .

 class A { private B b; public foo() { b = new B(this); } } class B { public B(A a) { foo(); a.bar(); } } 
+5
source share
2 answers

This websequencediagrams script seems to be capturing your code

 User->A: foo A-->>+B: <<create>> B->B: foo B->A: bar B-->>A: A-->>User: 

enter image description here

You can confirm the notation http://www.uml-diagrams.org/sequence-diagrams-reference.html

EDIT: And this is the same message sequence as on Enterprise Architect

enter image description here

+3
source

UML specs (2.5 beta) talk about it

An object creation message (messageSort equals createMessage) has a dashed line with an open arrow.

Figure 17.14 shows the following: UML 2.5 Figure 17.14 But in any case you do this, I would simulate each operation in my own sequence diagram . Therefore, I would simulate your example code as such:

enter image description here

+2
source

Source: https://habr.com/ru/post/1207153/


All Articles