Transfer from >>http://blog.csdn.net/mingxuanyun/article/details/8572128
Interaction diagrams are used to describe how objects in a system interact, that is, how a set of objects are communicated.
an interaction diagram consists of a set of objects and their relationships, including: What objects are needed, what messages are sent between objects, what role initiation messages are sent, and in what order.
Classification of interactive graphs:
The interaction diagram is divided into two types: sequence diagram and collaboration diagram.
- Sequence diagram-emphasizes the sequence of events for messages
- Collaboration diagram-emphasizes the interaction between objects
A sequence diagram describes the time order in which messages are passed between objects, which is used to denote the order of behavior in a use case.
sequence diagrams, including chronological order, do not include object contact. That is to say, in order to build a sequence diagram, we only need to take into account the sequence of system behavior, but not the relationship between them. It is possible to draw the behavior between objects in chronological order.
in UML , a sequence diagram describes the interaction between objects in a system by a two-dimensional graph. Where the longitudinal axis represents time and the horizontal axis represents the object that participates in the interaction.
the composition of the sequence diagram:
- -Objects and roles: the rectangle above. In the interaction diagram, the object that participates in the interaction can be both a concrete thing and a prototype thing. As a specific thing, an object represents something in the real world.
- Lifeline and control Focus: Each object has its own lifeline, and the object lifeline is a vertical dashed line to indicate that an object exists for a period of time
- Message: Is the communication between objects, which can be either a signal or an action call.
there are several forms of the message:
- Call: Represents an action that invokes an object. Can be a call between objects, or you can make calls to the object itself.
- Return (return) Returns a value that represents the called object returned to the caller.
- Sendsend): Object sending signal, different from call , the invocation is a mechanism of synchronization, and the signal is an asynchronous mechanism. That is, when the object a Call object ba After the message is sent, it will wait for b After executing the method that was called and then continuing, if the object a sent a signal to the object bA
- -Create (creat) creation means the beginning of the object lifeline,
- Destruction (destory) is usually connected to the end of life symbol of the target object
How messages are represented: messages from one object to another are represented by a message line that spans the object lifeline, including the reflexive message
Classification of messages:
Synchronization: To a certain extent can be regarded as a single thread, the thread after requesting a method, just wait for this method to reply to him, or he will not go down execution.
Async: To some extent, it can be seen as a multi-threaded. After you have requested a method, continue with the other methods.
PS: In general, the simple message is OK.
Collaboration diagrams: Emphasize organizations that participate in interactive objects.
The relationship between a collaboration diagram and a sequence diagram:
- The two are semantically equivalent.
- They can transform each other.
- The focus of the two is different:
- Sequence diagram emphasizes time order
- Collaboration diagrams focus on the relationships between objects.
Interaction diagram < go > in UML