Types Of Interaction Diagram

Posted : admin On 1/25/2022

Use case diagram mostly use to model the interactions between system and external actors (users or other systems). Sequence diagram are used to model interactions between system components. The sequence diagram represents the flow of messages in the system and is also termed as an event diagram. It helps in envisioning several dynamic scenarios. It portrays the communication between any two lifelines as a time-ordered sequence of events, such that these lifelines took part at the run time. In UML, the lifeline is represented by a vertical bar, whereas the message flow is represented by a vertical. Start studying Types of Interactions (Science). Learn vocabulary, terms, and more with flashcards, games, and other study tools.

Interaction Diagrams

There are two types of interaction diagrams - sequence diagrams and collaboration diagrams. Each diagram is a graphical view of the scenario. There are two types of frame shown: interaction frames which depict any type of UML interaction diagram (sequence diagram, communication diagram.

The use case diagram presents an outside view of the system.The functionality of the use case is captured in the flowof events. Scenarios are used to described how use casesare realized as interactions among societies of objects. A scenario is an instance of a use case -- it is one paththrough the flow of events for the use case. Scenarios aredeveloped to help identify the objects, the classes, and theobject interactions needed to carry out a piece of the functionality specified by the use case.

Each use case is a web of scenarios -- primary scenarios(the normal flow for the use case) and secondaryscenarios (the what-if logic of the use case). During earlystage of analysis, it is safe to say that looking at the primaryscenarios for each identified use case is enough.

Scenarios are captured in interaction diagrams. There are two typesof interaction diagrams -- sequence diagrams and collaborationdiagrams. Each diagram is a graphical view of the scenario.

Sequence Diagrams

A sequence diagram show object interactions arranged in time sequence.It depicts the objects and classes involved in the scenarioand the sequence of messages exchanged between objectsneeded to carry out the functionality of the scenario.

In a sequence diagram, it consists of objects. Each object hasits timeline represented by a dashed line below the object.Messages between objects are represented by arrows that pointfrom the client (sender of the message) to the supplier(receiver of the message).

3 Types Of Interaction Diagrams

Notations of objects, dashed lines, and messages are shown inpages 77--78. The sequence diagram for the Create a Courseis shown in page 80.

Messages

A message is the specification of a communication among objectsthat conveys information with the expectation that activity willensure. The receipt of a message instance may be considered aninstance of an event. The most common kind of message you'll modelis the call, in which one object invokes an operation of another(or the same) object.

When an object passes a message to another object (in effect,delegating some action to the receiver), the receiving objectmight in turn send a message to another object. In the UML,you can model several kinds of actions.
  • Call: Invokes an operation on an object; an object maysend a message to itself, resulting in the local invocation of anoperation.
  • Return: Returns a value to the caller.
  • Send: Sends a signal to an object.
  • Create: Creates an object.
  • Destroy: Destroys an object; an object may commit suicideby destroying itself.

Collaboration Diagrams

A collaboration diagram is an alternate way to show a scenario.A collaboration diagram contains:
  • Objects drawn as rectangles
  • Links between objects shown as lines connecting the linked objects
  • Messages shown as text and an arrow that points from the clientto the supplier.
If you created a sequence diagram, its corresponding collaborationdiagram can be generated automatically.
  • UML Tutorial
  • UML 2.0 Overview
  • UML Useful Resources
  • Utilities
  • Selected Reading

From the term Interaction, it is clear that the diagram is used to describe some type of interactions among the different elements in the model. This interaction is a part of dynamic behavior of the system.

This interactive behavior is represented in UML by two diagrams known as Sequence diagram and Collaboration diagram. The basic purpose of both the diagrams are similar.

Sequence diagram emphasizes on time sequence of messages and collaboration diagram emphasizes on the structural organization of the objects that send and receive messages.

Concrete Interaction Diagrams

Purpose of Interaction Diagrams

The purpose of interaction diagrams is to visualize the interactive behavior of the system. Visualizing the interaction is a difficult task. Hence, the solution is to use different types of models to capture the different aspects of the interaction.

Sequence and collaboration diagrams are used to capture the dynamic nature but from a different angle.

The purpose of interaction diagram is −

  • To capture the dynamic behaviour of a system.

  • To describe the message flow in the system.

  • To describe the structural organization of the objects.

  • To describe the interaction among objects.

How to Draw an Interaction Diagram?

As we have already discussed, the purpose of interaction diagrams is to capture the dynamic aspect of a system. So to capture the dynamic aspect, we need to understand what a dynamic aspect is and how it is visualized. Dynamic aspect can be defined as thesnapshot of the running system at a particular moment

Types of interaction diagrams

We have two types of interaction diagrams in UML. One is the sequence diagram and theother is the collaboration diagram. The sequence diagram captures the time sequence ofthe message flow from one object to another and the collaboration diagram describes theorganization of objects in a system taking part in the message flow.

Following things are to be identified clearly before drawing the interaction diagram

  • Objects taking part in the interaction.

  • Message flows among the objects.

  • The sequence in which the messages are flowing.

  • Object organization.

Following are two interaction diagrams modeling the order management system. The first diagram is a sequence diagram and the second is a collaboration diagram

The Sequence Diagram

The sequence diagram has four objects (Customer, Order, SpecialOrder and NormalOrder).

The following diagram shows the message sequence for SpecialOrder object and the same can be used in case of NormalOrder object. It is important to understand the time sequence of message flows. The message flow is nothing but a method call of an object.

Types

The first call is sendOrder () which is a method of Order object. The next call is confirm () which is a method of SpecialOrder object and the last call is Dispatch () which is a method of SpecialOrder object. The following diagram mainly describes the method callsfrom one object to another, and this is also the actual scenario when the system is running.

The Collaboration Diagram

Process Interaction Diagram

Types of interaction diagrams include

The second interaction diagram is the collaboration diagram. It shows the object organization as seen in the following diagram. In the collaboration diagram, the method call sequence is indicated by some numbering technique. The number indicates how themethods are called one after another. We have taken the same order management system to describe the collaboration diagram.

Method calls are similar to that of a sequence diagram. However, difference being the sequence diagram does not describe the object organization, whereas the collaboration diagram shows the object organization.

To choose between these two diagrams, emphasis is placed on the type of requirement. If the time sequence is important, then the sequence diagram is used. If organization is required, then collaboration diagram is used.

Where to Use Interaction Diagrams?

We have already discussed that interaction diagrams are used to describe the dynamic nature of a system. Now, we will look into the practical scenarios where these diagrams are used. To understand the practical application, we need to understand the basic natureof sequence and collaboration diagram.

The main purpose of both the diagrams are similar as they are used to capture the dynamic behavior of a system. However, the specific purpose is more important to clarify and understand.

Types Of Interaction Diagram In Ooad

Sequence diagrams are used to capture the order of messages flowing from one object to another. Collaboration diagrams are used to describe the structural organization of the objects taking part in the interaction. A single diagram is not sufficient to describe the dynamic aspect of an entire system, so a set of diagrams are used to capture it as a whole.

Types Of Interaction Biology Diagram

Interaction diagrams are used when we want to understand the message flow and the structural organization. Message flow means the sequence of control flow from one object to another. Structural organization means the visual organization of the elements in a system.

Two Types Of Interaction Diagrams

Interaction diagrams can be used −

System Interaction Diagram

  • To model the flow of control by time sequence.

  • To model the flow of control by structural organizations.

  • For forward engineering.

  • For reverse engineering.