Interaction diagram in UML

Source: Internet
Author: User

The interaction diagram is used to describe how objects interact in the system, that is, how a group of objects transmit messages.

An interaction diagram consists of a group of objects and their relationships, including: What objects are required, what messages are sent between objects, what roles start a message, and how messages are sent in what order.

Interaction graph classification:

Interaction graphs are divided into two types: sequence graphs and collaborative graphs.

  • Sequence Chart-emphasize the Event Sequence of messages
  • Collaboration diagram-emphasizing the interaction between objects

The sequence diagram describes the time sequence of passing messages between objects. It is used to indicate the behavior sequence in the use case.

Sequence diagram, including chronological order, excluding object contact. That is to say, in a sequence chart, we only need to consider the sequence of system behaviors, rather than the relationship between them. You can draw actions between objects in chronological order.

In UML, a two-dimensional diagram describes the interaction between objects in the system. The vertical axis indicates the time, and the horizontal axis indicates the objects involved in the interaction.

Composition of the sequence chart:

  1. -Object and role: rectangular box above. In the interaction diagram, the objects involved in interaction can be both specific and prototype objects. As a specific thing, an object represents something in the real world.
  2. Lifeline and control focus: each object has its own lifeline. The object lifeline is a vertical dotted line to indicate that an object exists for a period of time.
  3. Message: communication between objects, which can be signals or operation calls.

Among them, messages are mainly in the following forms:

  1. Call: an operation that calls an object. It can be a call between objects, or call the object itself.
  2. Return indicates that the called object returns a value to the caller.
  3. Send: an object sends signals. Different from a call, a call is a synchronous mechanism, while a signal is an asynchronous mechanism. That is to say, when object a calls object B, after a sends the message, it will wait until B executes the called method; if object a sends a signal to object B, object a continues to run after the signal is sent.
  4. -Creat indicates the beginning of the object lifeline,
  5. The destroy (destory) is usually connected with the life termination symbol of the target object.

Message Representation Method: It is represented by a message line. messages from one object to another are represented by a message line spanning the object lifeline, including reverse messages.

Message category:

Synchronization: to a certain extent, it can be regarded as a single thread. After the thread requests a method, it waits for the method to reply to it; otherwise, it will not execute it.

Asynchronous: to a certain extent, it can be seen as a multi-thread. After a method is requested, the other methods are executed.

PS: Generally, you can use a simple message.

Collaboration diagram: emphasize the organizations that participate in interaction objects.


Relationship between a collaboration diagram and a sequence diagram:

  • The two are semantically equivalent.
  • The two can convert each other
  • The two have different focuses:

  1. Sequence diagram emphasizes chronological order
  2. A collaboration diagram focuses on the relationship between objects.

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.