Contents
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:
- Objects
- Links
- 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:
- To model flows of control by time ordering
- 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,
- Set the context for the interaction, whether it is a system, subsystem, operation or class or one scenario of a use case or collaboration.
- Identify the objects that take part in the interaction and lay them out at the top along the x-axis in a sequence diagram.
- Set the life line for each object.
- Layout the messages between objects from the top along the y-axis.
- To visualize the points at which the object is performing an action, use the focus of control.
- To specify time constraints, adorn each message with the time and space constraints.
- 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,
- Set the context for the interaction, whether it is a system, subsystem, operation or class or one scenario of a use case or collaboration.
- Identify the objects that take part in the interaction and lay them out in a collaboration diagram as the vertices in a graph.
- Set the initial properties of each of these objects.
- Specify the links among these objects.
- 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.
- To specify time constraints, adorn each message with the time and space constraints.
- To specify the flow of control in a more formal manner, attach pre and post conditions to each message.
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.
Leave a Reply