A sequence diagram is used to show the interaction sequence between objects. A sequence diagram represents an interactive relationship as a two-dimensional diagram. Vertical is time
Sequence Diagram overview:
A sequence diagram is used to show the interaction sequence between objects.
A sequence diagram represents an interactive relationship as a two-dimensional diagram. The vertical line is the timeline, and the time goes down along the vertical line. The horizontal axis represents the class meta-roles of independent objects in the collaboration. The class meta-role is represented by a lifeline. When an object exists, the role uses a dotted line. when the object is activated, the lifeline is a dual line.
Messages are represented by arrows from the lifeline of an object to the lifeline of another object. Arrows are arranged from top to bottom in chronological order.
Elements involved in a two-step diagram:
1. Role)
System role, which can be a person, another system, or a subsystem
2. Object)
There are three naming methods:
(1) including the object name and class name
(2) only show the class name. if the class name is not displayed, it indicates that it is an anonymous object.
(3) only show object names, not show class names
3. lifeline
The lifeline represents a dotted line extending down from the object icon in a sequence diagram, indicating the time when the object exists.
4. Focus of Control)
The control focus is the symbol that represents the time period in the sequence diagram. during this time period, the object will perform corresponding operations, represented in a small rectangle.
5. messages
Messages are generally divided into Synchronous Message, Asynchronous Message, and Return Message)
(1) synchronous message: the message sender sends control to the receiver of the message, and then stops the activity, waiting for the receiver to give up or return control. Used to indicate the meaning of synchronization.
(2) Asynchronous message: the message sender transmits the signal to the receiver of the message and continues his/her own activity without waiting for the receiver to return the message or control the message. The receiver and sender of asynchronous messages work concurrently.
(3) return message: The Returned message indicates that the request is returned from the process call.
6. Self-associated Message)
Indicates the call of the method itself and one method in an object to call another method.
Example of withdrawal from three depositors:
Example of a user withdrawing money from an ATM using a sequence diagram:
Conclusion:
1. Use a sequence diagram to draw the main process and use annotations or text to describe the special process.
2. if a special process is also important, you can use a sequence diagram to express it.
3. if there are many branches and they are important, the activity chart is preferred instead of the sequence chart.
Original article: http://www.cnblogs.com/ywqu/archive/2009/12/22/1629426.html