Sequence diagrams are primarily used to show the order in which objects interact with each other.
A sequence diagram represents an interaction as a two-dimensional graph. The vertical is the timeline, and the time extends downward along the vertical bar. The horizontal axis represents the meta roles of individual objects in collaboration. The class meta role is represented by a lifeline. When an object is present, the character is represented by a dashed line, and the lifeline is a double-lane when the object's procedure is active.
Messages are represented by arrows from the lifeline of one object to the lifeline of another object. The arrows are arranged in chronological order from top to bottom in the diagram.
Elements involved in a sequence diagram:
1. Lifeline:
The lifeline name can be underlined. When an underscore is used, it means that the lifeline in the sequence diagram represents a specific instance of a class.
2. Synchronizing Messages
The sender waits for a synchronous message response before it continues.
3. Asynchronous Messages
There is no need to wait for a response message until the sender continues.
4. Notes
5. Constraints
The symbol for the constraint is simple; the format is: [Boolean Test]
6. Combining Fragments
Combined Fragments used to solve the conditions and methods of interactive execution . It allows a logical component to be represented directly in a sequence diagram to define special conditions and sub-processes for any part of any lifeline by specifying the conditions or the area of application of the child process.
Common combinations of fragments are:
Choice (Alt )
The choice used to indicate a mutually exclusive selection between two or more message sequences, equivalent to the classic if. else ...
The choice takes place only one sequence in any situation. You can set a threshold in each fragment to indicate the conditions that the fragment can run. Else The critical indicates that any other critical is not true when the fragment should run. If all the thresholds are False and there is no else, no fragments are executed.
option (Opt )
Contains a sequence that can or does not occur
Loop (Loop )
The fragment repeats a certain number of times. You can indicate the condition of the fragment repetition in the threshold.
Parallel (Par )
The following table lists the commonly used combined fragments:
Fragment type |
Name |
Description |
Opt |
Options |
Contains a sequence that may or may not occur. You can specify the condition in which the sequence occurs in the critical. |
Alt |
Choice |
Contains a list of fragments that contain an alternate message sequence. Only one sequence occurs on any occasion. You can set a threshold in each fragment to indicate the conditions that the fragment can run. Else The critical indicates that any other critical is not true when the fragment should run. If all the thresholds are False and there is no else, no fragments are executed. |
Loop |
Cycle |
The fragment repeats a certain number of times. You can indicate the condition of the fragment repetition in the threshold. Loop Combo fragments have the min and Max properties, which indicate the minimum and maximum number of times a fragment can be repeated. The default value is unrestricted. |
Break |
Interrupt |
If this fragment is executed, the remainder of the sequence is discarded. You can use a guard to indicate the condition in which the interrupt occurred. |
Par |
Parallel |
Parallel processing. Events in a fragment can be interleaved. |
Critical |
The essential |
Used in Par or Seq fragments. Indicates that messages in this fragment must not be interleaved with other messages. |
Seq |
Weak order |
There are two or more operand fragments. Messages involving the same lifeline must occur in the order of the fragments. Messages from different fragments may be interleaved in parallel if the message involves a different lifeline. |
Strict |
Strong order |
There are two or more operand fragments. These fragments must occur in the given order. |
Fragment about how to interpret a sequence
By default, a sequence diagram indicates a series of messages that may occur. On a running system, you may see other messages that you have not selected to display on the diagram.
The following fragment types can be used to change this interpretation:
Fragment type |
Name |
Description |
Consider |
Consider |
Specifies the list of messages described by this fragment. Other messages can occur on a running system, but this is not a very meaningful description. Type the list in the Messages property. |
Ignore |
Ignore |
A list of messages not described in this fragment. These messages can occur in a running system, but it does not make much sense for this description. Type the list in the Messages property. |
Assert |
Assertion |
The operand fragment specifies the only valid sequence. Typically used in consider or Ignore fragments. |
Neg |
Negative |
The sequence shown in this fragment must not occur. Typically used in consider or Ignore fragments. |
UML Sequence Diagram Summary (Loop, Opt, par, and ALT)