UML Tutorial for Beginners
Blog containing resources for uml like lecture notes, lecture videos, lab manual, uml diagrams, objective bits, important questions and more.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Behavioral Modeling. No Comments on Interaction Diagrams

Introduction

 

An interaction diagram represents an interaction, which contains a set of objects and the relationships between them including the messages exchanged between the objects.

 

A sequence diagram is an interaction diagram in which the focus is on time ordering of messages. Collaboration diagram is another interaction diagram in which the focus is on the structural organization of the objects. Both sequence diagrams and collaboration diagrams are isomorphic diagrams.

 

Common Properties

 

Interaction diagrams share the properties which are common to all the diagrams in UML. They are: a name which identifies the diagram and the graphical contents which are a projection into the model.

 

Contents

 

Interaction diagrams commonly contain:

  1. Objects
  2. Links
  3. Messages

 

Like all other diagrams, interaction diagrams may contain notes and constraints.

 

Sequence Diagrams

 

A sequence diagram is one of the two interaction diagrams. The sequence diagram emphasizes on the time ordering of messages. In a sequence diagram, the objects that participate in the interaction are arranged at the top along the x-axis.

 

Generally, the object which initiates the interaction is placed on the left and the next important object to its right and so on. The messages dispatched by the objects are arranged from top to bottom along the y-axis. This gives the user the detail about the flow of control over time.

 

Sequence diagram has two features that distinguish them from collaboration diagrams. First, there is the object lifeline, which is a vertical dashed line that represents the existence of an object over a period of time. Most of the objects are alive throughout the interaction.

 

Objects may also be created during the interaction with the receipt of the message stereotyped with create. Objects may also be destroyed during the interaction with the receipt of the message stereotyped with destroy.

 

Second, there is focus of control which is represented as a thin rectangle over the life line of the object. The focus of control represents the points in time at which the object is performing an action. We can also represent recursion by using a self message.

 

Collaboration Diagrams

 

A collaboration diagram is one of the two interaction diagrams. The collaboration diagram emphasizes on the structural organization of the objects in the interaction.

 

A collaboration diagram is made up of objects which are the vertices and these are connected by links. Finally, the messages are represented over the links between the objects. This gives the user the detail about the flow of control in the context of structural organization of objects that collaborate.

 

Collaboration diagram has two features that distinguish them from the sequence diagrams. First, there is a path which indicates one object is linked to another. Second, there is a sequence number to indicate the time ordering of a message by prefixing the message with a number.

 

We can use Dewey decimal numbering system for the sequence numbers. For example a message can be numbered as 1 and the next messages in the nested sequence can be numbered 1.1 and so on.

 

Common Uses

 

We use interaction diagrams to model the dynamic aspects (interactions) of the system. When we use an interaction diagram to model some dynamic aspect of a system, we do so in the context of the system as a whole, a subsystem, an operation or a class. We typically use the interaction diagrams in two ways:

  1. To model flows of control by time ordering
  2. To model flows of control by organization

 

Common Modeling Techniques

 

Modeling flow of control by time ordering

 

To model a flow of control by time ordering,

  1. Set the context for the interaction, whether it is a system, subsystem, operation or class or one scenario of a use case or collaboration.
  2. Identify the objects that take part in the interaction and lay them out at the top along the x-axis in a sequence diagram.
  3. Set the life line for each object.
  4. Layout the messages between objects from the top along the y-axis.
  5. To visualize the points at which the object is performing an action, use the focus of control.
  6. To specify time constraints, adorn each message with the time and space constraints.
  7. To specify the flow of control in a more formal manner, attach pre and post conditions to each message.

 

Modeling flow of control by organization

 

To model a flow of control by organization,

  1. Set the context for the interaction, whether it is a system, subsystem, operation or class or one scenario of a use case or collaboration.
  2. Identify the objects that take part in the interaction and lay them out in a collaboration diagram as the vertices in a graph.
  3. Set the initial properties of each of these objects.
  4. Specify the links among these objects.
  5. Starting with the messages that initiate the interaction, attach each subsequent message to the appropriate link, setting its sequence number, as appropriate. Use Dewey numbering system to specify nested flow of control.
  6. To specify time constraints, adorn each message with the time and space constraints.
  7. To specify the flow of control in a more formal manner, attach pre and post conditions to each message.

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.

He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.

He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

Leave a Reply

Your email address will not be published. Required fields are marked *