20

How do I show that the WebServer instantiates a View and gets back control of the flow? Maybe I'm not using the right type of diagram? Thanks a bunch!

alt text

Community
  • 1
  • 1
LeWoody
  • 3,593
  • 4
  • 25
  • 31

3 Answers3

19

The diagram from Ruben's answer is correct, but general UML answer is missing. It creates the other lifeline when the "create" line (dashed in this case) connects to the box/label/top of the created life line. From example: WebServer in it's action creates a View and the action done by the view creates the Widget.

-----
| a |
-----
  |
  []---->-----
  []     | b |
  |      -----
  |        |

There are also several diagrams here.

The UML 2.2 specifications (superstructure) has an example on page 474, Figure 14.11 is their canonical syntax/notation reference. And on page 495 in the notation section it states "Object creation Message has a dashed line with an open arrow." This is further defined in the UML as the message type is an enumeration called MessageSort. One value is:

"• asynchSignal - The message was generated by an asynchronous send action.createMessage - The message designating the creation of another lifeline object."

Ted Johnson
  • 4,315
  • 3
  • 29
  • 31
  • +1 thanks for the link, isn't Ambler great? I unfortunately don't understand the last two paragraphs, but you answered the question! Thanks.. – LeWoody Jan 28 '10 at 22:10
10

Correct, use a "create" message to show instantiation of the object represented by the target lifeline. Here's an example from a topic in the VS 2010 Ultimate docs:

Create message on a sequence diagram

UML Sequence Diagrams: Reference at http://msdn.microsoft.com/en-us/library/dd409377%28VS.100%29.aspx

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Esther Fan - MSFT
  • 8,276
  • 4
  • 27
  • 25
  • Out of interest, how do you show when multiple instances of the same object exists at the same time ? e.g instance of object A lets call it A1 is created and exist for some time and while it exists another instance is creaed A2 do you just use another activation bar and make them overlap ? – IronHide Apr 21 '16 at 08:31
  • 1
    Why does the `Order` live before it's been created? Seems to be wrong. – Zelphir Kaltstahl Jan 30 '17 at 11:09
3

Yes you can, using a create message. Sometime it depends on the tool you are using. Anyway you just need an arrow that show the text create pointing to the object being created.

phunehehe
  • 8,618
  • 7
  • 49
  • 79