UML Sequence Diagrams: Reference
In Visual Studio Ultimate, a sequence diagram shows an interaction, which represents the sequence of messages between instances of classes, components, subsystems, or actors. Time flows down the diagram, and it shows the flow of control from one participant to another. To create a UML sequence diagram, on the Architecture menu, click New Diagram.
The diagram shows example instances and events, instead of classes and methods; more than one instance of the same type can appear in the diagram, and more than one occurrence of the same message can appear also.
There are two kinds of sequence diagram:
Code-based Sequence Diagrams can be generated from .NET program code, and can be placed within any project. For more information, see Visualize Code by Generating Sequence Diagrams.
UML Sequence Diagrams form part of a UML model, and exist only within UML modeling projects. For more information, see UML Sequence Diagrams: Guidelines.
The two kinds of sequence diagram are similar, although a few of the properties of the elements are different.
For more information about how to create and draw modeling diagrams, see How to: Edit UML Models and Diagrams.
Reading Sequence Diagrams
The following table describes the elements that you can see on a sequence diagram. For information about the properties of these elements, see Properties of Elements in UML Sequence Diagrams.
For a information about how to use sequence diagrams, see UML Sequence Diagrams: Guidelines.
Shape |
Element |
Description |
---|---|---|
1 |
Lifeline |
A vertical line that represents the sequence of events that occur in a participant during an interaction, while time progresses down the line. This participant can be an instance of a class, component, or actor. |
2 |
Actor |
A participant that is external to the system that you are developing. You can make an actor symbol appear at the top of a lifeline by setting its Actor property. |
3 |
Synchronous message |
The sender waits for a response to a synchronous message before it continues. The diagram shows both the call and the return. Synchronous messages are used to represent ordinary function calls within a program, as well as other kinds of message that behave in the same way. |
4 |
Asynchronous message |
A message that does not require a response before the sender continues. An asynchronous message shows only a call from the sender. Use to represent communication between separate threads or the creation of a new thread. |
5 |
Execution occurrence |
A vertical shaded rectangle that appears on a participant's lifeline and represents the period when the participant is executing an operation. The execution begins where the participant receives a message. If the initiating message was a synchronous message, the execution ends with a «return» arrow back to the sender. |
6 |
Callback message |
A message that returns back to a participant that is waiting for the return from an earlier call. The resulting execution occurrence appears on top of the existing one. |
7 |
Self message |
A message from a participant to itself. The resulting execution occurrence appears on top of the sending execution. |
8 |
Create message |
A message that creates a participant. If a participant receives a create message, it should be the first it receives. |
9 |
Found message |
An asynchronous message from an unknown or an unspecified participant. |
10 |
Lost message |
An asynchronous message to an unknown or an unspecified participant. |
11 |
Comment |
A comment can be attached to any point on a lifeline. |
12 |
Interaction Use |
Encloses a sequence of messages that are defined in another diagram. To create an Interaction Use, click the tool and then drag across the lifelines you want to include. |
13 |
Combined Fragment |
A collection of fragments. Each fragment can enclose one or more messages. There are different kinds of combined fragments. For more information, see Describing Control Flow with Fragments in UML Sequence Diagrams. To create a fragment, right-click a message, point to Surround With, and then click a fragment type. |
14 |
Fragment Guard |
Can be used to state a condition relevant to whether the fragment will occur. To set the guard, select a fragment, then select the guard, and type a value. |
X |
Destruction Event |
Represents the point at which the object is deleted or no longer accessible. Appears at the bottom of every lifeline. |
Interaction |
The collection of messages and lifelines that is displayed in the sequence diagram. To view the properties of an Interaction, you must select it in UML Model Explorer. |
|
Sequence Diagram |
The diagram that displays an Interaction. To view its properties, click on an empty part of the diagram. Note The names of the Sequence Diagram, the Interaction that it displays, and the file that contains the diagram can all be different. |
See Also
Concepts
UML Sequence Diagrams: Guidelines
How to: Edit UML Models and Diagrams
UML Use Case Diagrams: Reference