first, the conceptThe interaction diagram describes the dynamic cooperative relationship between objects and the order of behavior in the process of cooperation. Interaction diagrams are often used to describe the behavior of a use case, to show the objects involved in the use case and the message delivery between those objects, i.e. the implementation of a use case.
there are two forms of interaction graph, Order diagram and collaboration graph. the sequence diagram describes objects in chronological order of message exchange. Collaboration diagrams describe how system components work together.
The sequence diagram and the collaboration diagram express the interaction and system behavior of the system from different angles, and they can transform each other. Sequence diagrams (Sequence Diagram) are also called sequential graphs. Communication diagrams (communication Diagram) are also known as collaboration diagrams. second, timing diagram The 2.1 concept sequence diagram is a time-ordered representation, mainly used to describe the chronological order of the messages that are passed between the object classes that complete a behavior and those object classes. A sequence diagram is an interaction diagram that emphasizes the time order of messages. A sequence diagram describes the chronological order in which messages are sent between objects, and is used to represent the order of behavior in a use case.
sequence diagram (Sequence Diagram) = Lifeline (Lifeline) + messages (message)
A sequence diagram represents an interactive relationship as a two-dimensional graph. Where the longitudinal axis is the timeline and the time extends downward along the vertical bar. The horizontal axis represents the individual objects in the collaboration.
The sequence diagram contains 4 elements: Object, lifeline, message, activation
visual of a sequence diagram:
UML Asynchronous Message: Modeling software uses solid line arrows to indicate. 2.2 Lifeline
Each object and participant has a vertical lifeline (Lifeline) that represents the lifetime of the interaction.
Presentation: The lifeline is represented by a rectangular box and dotted line, the name of the lifeline is added to the rectangle, and the dotted line represents the length of life.
Lifeline name Syntax : Lifeline object Name [selector]: Class name ref decomposition (blue indicates optional option)
Selectors: Objects of the same class can have different state values, which can be indicated in this.
Ref: is a reference (Reference) of the English abbreviation
Decomposition: Indicates the details of how the current interaction participant handles the information it receives in another, more detailed sequence diagram 2.3 Interactive bar
The activity bar (activation bar), also known as execution occurrence (Execution occurrence), is used to represent the execution state of an object's behavior.
Representation: a small rectangular bar on a dashed line. 2.4 News Introduction to Messages
The behavior of an object is also known as a message, which typically completes a message delivery when one object invokes the behavior in another object. Presentation Method
A solid arrow between lifelines indicates the name of a message message
Signal or message name (parameter: parameter type): Return value simple message, Sync message, asynchronous message
Messages are divided into simple messages, synchronous messages (synchronous message), and asynchronous message (asynchronous messages) Simple messages: Metrics control how to send another object from one object and contain no control information. Sync message: Means blocking and waiting for asynchronous messages: means not waiting
Representations are shown above , the visual character of the sequence diagram . Object Creation Message
The objects participating in the interaction do not have to exist throughout the full cycle of the entire sequence diagram interaction, and can be created and destroyed by sending messages as needed.
There are two ways to represent this: add the stereotype "create" above the message to indicate that the object was created during the interaction. The arrows of the message point directly to the head of the object lifeline being created, so that no stereotype "create" is required to express the object's destruction
The stereotype "destroy" is placed above the message to express an object destroy message, while an "X" is drawn at the end of the lifeline of the object to indicate that the object was destroyed without triggering and no messages received from the object
No Trigger object messages (Found message): indicated by the solid ball arrows on the start breakpoint of the active bar. (used in the beginning)
No receive object messages (lost message): indicated by arrows plus solid ball. (used in the end)
Control Information 1. condition control Information
Messages are sent when the condition of an expression is true
Syntax: [expression] Message label 2, repeating (iterative) control information
Messages are sent to the receiving object multiple times, and the iteration condition is an expression that ends when the expression's decision is true
Syntax: *[expression] Message label message return value
Presentation: 2.5 Interactive box with dotted line plus arrow
UML2.0 added an interactive frame (interaction frame).
An interaction frame refers to an area (Region) or fragment (Fragment) on the way, containing an operator (or label) and containing a guard.
type |
parameter |
meaning |
ref |
None |
indicates that the interaction is defined in another diagram. A larger graph can be divided into several smaller graphs to facilitate the management and reuse of graphs. The |
assert |
None |
represents the interactive, only valid execution path that occurs within the interaction box, helping to indicate when each step of the interaction must be executed successfully, usually with a state variable to enhance the system's A state. |
loop |
min Times,max times,[guard_condition] |
loop fragment to perform a loop when the condition is true. It can also be written as a loop (n) to indicate a loop n times, similar to a for loop in Java or C #. |
break |
None |
If the interaction contains a break, any enclosing behavior in the interaction must be introduced, especially the loop fragment, which is similar to the break statement in Java. |
alt |
[Guard_condition1] ... [Guard_condition2] ... [Else] |
Select fragments to express mutually exclusive conditional logic in the realm, with If...else ... statements are similar. The |
neg |
none |
shows an invalid interaction. |
opt |
[guard_condition] |
Optional fragment that executes when the alert value is true. |
par |
no |
parallel fragment, expressing parallel execution. The |
region |
No |
area indicates that only one thread can be run within a zone. |
Note: The following diagram is placed in the center position (because the software is not aligned to the left, understand the good, later fixed.) ) alt
The image above understands that message GetPrice is sent to Salemanagement and then selected according to quantity value if quantity value is less than Miniamount, Then Salemanagement will send a message to retail getprice Otherwise, Salemanagement will send a message to wholesale GetPrice loop
par
It can be understood that saveuserdata () and Checkqualification () will run in parallel. 2.6 Sequence Diagram Modeling Technology Identifies the context of interaction. Sets the scene of the interaction by identifying the role that the object plays in the interaction. Set a lifeline for each object. Starting with the information that triggers a message, draw a message from the top to the bottom, showing the attributes (such as parameters) for each message. If you need a visual message nesting or a point in time when the actual calculation occurs, you can modify the lifetime of each object with activation. If you need a more formalized description of a control flow, you can attach a predecessor and a post condition for each message. 2.7 points to note
An object does not have to be a class, it can be a contributor. third, collaboration diagram 3.1 Concepts
Collaboration diagrams, like sequential graphs, are also used to describe the message connection between objects and objects, focusing on explaining which objects have message passing.
Help graph = Interactive Participant + communication chain + message
A communication diagram describes a link to an object that participates in an interaction, emphasizing the link between sending and receiving objects. 3.2 Interactive participants
Representation: Represented by an object symbol, where an interactive participant is placed in a rectangular box, showing the name of the participant of the interaction and the class to which it belongs
Syntax: Contributor name: Class name
Note: Although there may be other objects throughout the system, only objects involving collaboration are represented.
4 types of objects that may appear in a collaboration diagram: objects that exist in the interaction in which objects that are created in interactions are destroyed in the interaction object 3.3 links created and destroyed in the protection of the action
Presentation: in straight lines. In general, a link is an instance of an association. Messages can flow through a link. 3.4 News
Presentation: A token arrow attached to a link and a message expression expressed with a sequential number. The arrows indicate the direction of the message. <1> Control Messages
Representation: in brackets.
Messages are sent only when the control condition is true.
nested messages and self messages
When a message causes another message to be sent (numbering distinguishes), the second message is called nesting in the first message.
Nesting can be chopped into nested sets. Loops
is similar to a loop in a sequence diagram.
Presentation by means of "*" asterisk. Concurrent Messages
As the name suggests, is a few messages are sent by colleagues, number is the first half can be the same, followed by the letter. Small Details
The number is separated from the second part by a colon.
In the blog I wrote two blog is the collation of resources, may be helpful to everyone, you can see if you are interested. Resource broadcast-book and video tutorials. Common Software-Finishing
Blog number: 20160614223910