Talking about the sequence diagram and collaboration diagram of the dynamic model of UML study notes

1. Sequence diagram

Both sequence diagrams and collaboration diagrams are interaction diagrams, which are equivalent to each other and can be transformed into each other. A sequence diagram is a visual representation of the time sequence in which messages are passed between objects. Sequence diagrams are used to represent interactions and focus on emphasizing chronological order.

The sequence diagram represents the interaction relationship as a two-dimensional diagram, as shown in the following figure:

Note: The dotted line indicates that the object is not in the active state at this time, and the double line indicates that the object is in the active state; the message is represented by an arrow from the lifeline of one object to the lifeline of another object.

1.1 The role of sequence diagrams:

  1. Validate and enrich a logical expression using context
  2. Refine the use case and further refine the requirements expressed by the use case
  3. Effectively describe the responsibilities of each class and the reasons why each class has corresponding responsibilities

1.2 The composition of the sequence diagram:

A sequence diagram is composed of objects, lifelines, activations, and messages. A diagram is worth more than a thousand words:

1.3 Advanced concepts of sequence diagrams:

2. Collaboration diagram

Collaboration: The interaction between a group of objects and objects that implement certain behaviors in a certain context.

A collaboration diagram is a diagram that expresses the cooperative relationship of objects.

2.1 The role of collaboration diagram:

1. Same as the first one in the sequence diagram

2. Spatial organization of objects and their interactions

3. Represents the implementation of a class operation

2.2 Composition of collaboration diagram:

Collaboration diagrams are composed of objects, messages, and chains. The concepts of objects and messages are the same as those in sequence diagrams, and I focus on chains.

Chain: An independent connection between two or more objects, is a tuple of object references, is an instance of an association.

Representation of a chain: one or more connected lines or arcs.

3. Comparison of sequence diagram and collaboration diagram:

The information expressed by the collaboration diagram and the sequence diagram is the same, but the method is different, and it can be transformed in an appropriate way. The difference between collaboration diagram and sequence diagram:

1. The collaboration diagram clearly expresses the role relationship, and defines the objects or chains in the collaboration through the collaboration roles.

2. The collaboration diagram does not represent time as a separate dimension, and sequence numbers must be used to determine the order of messages and parallel threads.

3. Both sequence diagrams and collaboration diagrams represent the interaction between objects. Sequence diagrams focus on time sequence, while collaboration diagrams focus on the relationship between objects. Time sequence can be obtained from the sequence number that objects flow through.

4. Sequence diagrams are used to represent solutions, while collaboration diagrams are used for detailed design of processes.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327059110&siteId=291194637