UML Learning sequence diagram and collaboration diagram

Source: Internet
Author: User

1. Sequence diagram (Sequence Diagram)

is used to display the relationships between objects, emphasizing the chronological order of messages between objects, and showing the interaction between objects. A sequence diagram is a table where display objects are arranged along the x-axis, and messages are arranged chronologically along the y-axis. Sequence diagrams mainly include the following elements: Class roles, lifelines, activation periods, messages, and so on.

Structured control in sequence diagrams: Description of commonly used frame operators

Type

Name

Meaning

Opt

Optional execution

The guardianship condition uses a Boolean expression enclosed in square brackets, and if the operator's condition of guardianship is set, then the body of the control operator will be controlled. Execute all control operators when the condition is met. Co-execution with judgment

Alt

Conditional execution

The body of the control operator is divided into several partitions with horizontal dashed lines, each of which represents a condition, and if the guardianship condition of a partition is true, the partition is executed, and if more than one guardianship condition is true, which partition is selected is indeterminate, and if none is true, skipping this control continues execution. The conditional judgment that expresses the mutex in the alert is similar to the If......else statement. Selective execution with judgment

Par

Concurrent execution

Indicates a common execution without judging the conditions.

Loop

Loop execution

Full execution of a repeatable loop with a judging condition. The difference from opt is that it can be repeated and executed as long as the condition is met.

Questions:

In rational rose, you don't know how to draw a frame interaction box.


Computer room charge system about the sequence diagram of the machine:

2. Collaboration Diagram (collaboration diagram/communication diagram) (Collaborationdiagram)

Describes a link between an interacting object, and he emphasizes the structure of the organization between sending and receiving objects. A collaboration diagram models only the interactions between objects and the relationships between those objects, ignoring other objects and associations. A collaboration diagram can be considered an extension of an object graph, but there is also a message passing in addition to the association between objects. Collaboration diagrams mainly include the following elements: objects (including participant instances and multiple objects), messages, chains, and so on.


The relationship between a collaboration diagram and a class diagram: The objects in the collaboration diagram are instances of the class diagram, and the collaboration diagram is similar to the class diagram if you remove the interactive part from the collaboration diagram. A communication diagram typically does not contain instances of all classes, knowledge contains instances of classes related to the collaboration diagram, and may contain multiple different instances of the same class on the collaboration diagram


Computer room charge system on the collaboration diagram:


Rational Rose provides automatic conversion between sequence diagrams and collaboration diagrams, with shortcut keys F5. The high similarity between them is explained, but they also have their own characteristics and advantages.

Difference:

The sequence diagram focuses more on the time sequence of message invocation, and the collaboration diagram focuses on how the system components work together, emphasizing the structural relationships between objects, and the links between the interaction participants.

Features:

Sequence diagram: Lifeline, control focus        &NB sp;     is relatively easier in terms of expression algorithms, the life of objects, and objects with multi-threaded features.

Collaboration diagram: path, ordinal                          the chain between objects and objects, and representations of multiple objects and active objects. Simple interaction between a small number of objects makes it easy to indicate how objects are connected together, but it is difficult to see the order in which messages occur.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.