[Sequence diagram notes] Step by step UML modeling series 5. Sequence diagram (Squence diagram) [transfer]

Overview

A sequence diagram is a diagram that details the interaction between objects and between objects and participant instances. It consists of a set of cooperating objects (or participant instances) and the messages that can be sent between them. Order.

A sequence diagram is a graphical document that details the dynamic connections between objects and between objects and actors outside the system. It expresses in detail and intuitively the behavioral dependencies of a set of cooperating objects when executing one (or a few) use cases, as well as the timing relationship between operations and messages. Class diagrams are not detailed enough to express messages (interactions) between objects; detailed descriptions are detailed but not intuitive enough to express messages; sequence diagrams are detailed and intuitive, but usually only represent interactions between a few objects.

 

Sequence diagrams basically contain four elements: 
Use case text that describes the flow of operations : On the left side of the sequence diagram, use white space to separate the text so it's easy to know which sentence corresponds to which element on the right. 
Object : represented by a box with two names, taken directly from the robustness graph. The two names are the class name and the object name (instance number), in the format class:object; either name can be omitted. Objects can also be displayed using the Robustness Graph construct type, which will help keep track of messages passed between actors, boundary objects, and implementation objects. 
Message : Arrow between objects. The message arrow can be located between two dashed lines, between a straight line and a method rectangle, or between two method rectangles.

Method (Operation) : Represented by a rectangle on the dashed line belonging to the object to which the method belongs. You can use the length of the rectangle to reflect when you have control focus. Controlling focus is useful in theory, but not in practice, as most visual modeling tools are not very powerful in this regard. If it is difficult to display control focus on the timing diagram, simply turn off this feature.

 

The structure of a sequence diagram

A Sequence Diagram is composed of elements such as Object, Lifeline, Activation, Messages, branches and subordinate flows.

1. Object

An object is an instance of a class. I think in a sequence diagram an object has three states: active, running (existing) and destroyed.

image

2. Lifeline

A lifeline is a vertical dotted line used to indicate the existence of objects in a sequence diagram over a period of time. As shown below, TravelApplication is a new lifeline of the Manage class New, which runs the CalculateDate() method after initialization.

image

3. Activate

A sequence diagram can describe the activation of an object. Activation is the execution of an object's operation. It represents the process by which an object completes an operation directly or through subordinate operations. In the UML diagram, it is represented by a narrow and long rectangle, and the height of the rectangle represents the process of the existence of the object.

image

 

 

4. News

Messages are a communication mechanism between objects. A signal is sent by a sending object to another or several other receiving objects, or an operation is invoked by one object (sender or caller) on another object (receiver).

image

  Synchronous message = call message (Synchronous Message )

  The sender of the message passes control to the receiver of the message, then stops activity, waiting for the receiver of the message to give up or return control. Used to indicate the meaning of synchronization.

 

  Asynchronous Message

  The sender of the message transmits the signal to the receiver of the message through the message, and then continues its own activities, without waiting for the receiver to return the message or control. Receivers and senders of asynchronous messages work concurrently.

  Return message (Return Message )

  The return message indicates the return from the procedure call

 

Self-Message

  Indicates the invocation of a method itself and the invocation of a method within an object by another method. As shown in the figure below, the DoAction method is called in the Context class, the DoAction method calls the SubmitData method, and the SubmitData method calls the SendRequest method.

image

 

5. Executor

Indicates who operates this object. As shown in the figure below, all operations are performed by employees.

image

 

6. Conditional judgment: used to describe the structure of if...else... in the code, marked as "alt"

image

 

7. The Switch will run when the conditions are met.

image

8. Loop loop, the same as For and Foreach in .NET.

image

 

9. The Gateway enters the window, and the code proceeds from here. If Client is a gateway

image

 

10. Interface, which represents the interface that interacts with other applications.

image

 

11. Lost Message, Lost Message.

image

 

 

Finally, let's look at the overall Sequence diagram

image

 

image

 

Complete example

 

full reference

Step by step UML modeling series five, sequence diagram (Squence diagram)--https://www.cnblogs.com/springyangwc/archive/2011/12/29/2306034.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325250360&siteId=291194637