Designing a UML 2.0 Sequence or Communication Diagram
Go Up to Interaction Diagram Procedures
Use the following tips and techniques when you design a UML 2.0 Sequence or Communication Diagrams. Usually you create Interaction Diagrams after Class Diagrams.
Whenever an interaction diagram is created, the corresponding interaction is added to the project. Interactions are represented as nodes in the Model View.
Note: Presentation of an interaction in the Model View depends on the view type defined in the Model View options on the default or project group levels. If model-centric mode is selected, an interaction is shown both under its package node and diagram node. If diagram-centric mode is selected, an interaction is shown under the diagram node only.
Note: You can view an interaction in two ways: as a Sequence Diagram, or as a Communication Diagram. So doing, any actions performed with either view are automatically reflected in the other views. Thus, adding or deleting an element in an interaction results in the modification of the corresponding interaction diagram, and vice versa. An interaction diagram contains a reference to the underlying interaction.
Note: Unlike UML 1.5, it is not possible to switch a diagram that already exists from sequence to communication and vice versa. However, it is possible to create a Sequence Diagram and a Communication Diagram based on the same interaction.
To design a UML 2.0 Sequence Diagram, follow this general procedure:
- Create an interaction use
- Navigate to a referenced interaction
- Associate a lifeline with a referenced element
- Associate a lifeline with a type
- Define decomposition for a lifeline
- Repeat the steps to create all required interactions
- Link the created lifelines by using messages
To create an interaction use:
- In the diagram Tool Palette, choose the Interaction Use button.
- Click on the target lifeline.
Tip: Alternatively, use the Add command on the lifeline context menu in the Diagram View or Model View.
- In the Object Inspector for the newly created interaction use, choose the Properties tab.
- In the Interaction name field, click the Chooser button.
Tip: Alternatively, just type in the interaction name.
- In the Choose Referenced Interaction dialog box, select the desired interaction from the project or Favorites, and click OK.
An interaction use is initially created attached to a lifeline. Further it can be expanded over several lifelines, detached from and reattached to lifelines.
To navigate to a referenced interaction:
- Right-click on an interaction use that refers to another interaction.
- On the context menu, choose Select.
- Choose the desired destination on the submenu.
To associate a lifeline with a referenced element:
- Make sure that your project contains the referenced elements that should be represented by the lifelines.
- Select the desired lifeline in the Model View or the Diagram View.
- In the Object Inspector, select the represents field.
- Click the chooser button.
- In the Choose Represented Connectable Element dialog box, select the desired part from the project or Favorites.
- Click OK.
To associate a lifeline with a type:
- Select the desired lifeline in the Model View or the Diagram View.
- In the Object Inspector, select the type field.
- Click the chooser button.
- In the Choose Represented Connectable Element's type dialog box, select the class that defined the type from the project or Favorites.
- Click OK.
To define decomposition for a lifeline:
- Select the desired lifeline in the Model View or the Diagram View.
- In the Object Inspector, select the decomposition field.
- Click the chooser button.
- In the Choose Referenced Interaction dialog box, select the desired interaction from the project or Favorites.
- Click OK.
Tip: Decomposition, type, stereotype, and referenced element properties are also reflected in the corresponding Communication diagram.