Designing a UML 2.0 Sequence or Communication Diagram

From RAD Studio
Jump to: navigation, search

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:

  1. Create an interaction use
  2. Navigate to a referenced interaction
  3. Associate a lifeline with a referenced element
  4. Associate a lifeline with a type
  5. Define decomposition for a lifeline
  6. Repeat the steps to create all required interactions
  7. Link the created lifelines by using messages

To create an interaction use:

  1. In the diagram Tool Palette, choose the Interaction Use button.
  2. Click on the target lifeline.

    Tip: Alternatively, use the Add command on the lifeline context menu in the Diagram View or Model View.

  3. In the Object Inspector for the newly created interaction use, choose the Properties tab.
  4. In the Interaction name field, click the Chooser button.

    Tip: Alternatively, just type in the interaction name.

  5. 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:

  1. Right-click on an interaction use that refers to another interaction.
  2. On the context menu, choose Select.
  3. Choose the desired destination on the submenu.

To associate a lifeline with a referenced element:

  1. Make sure that your project contains the referenced elements that should be represented by the lifelines.
  2. Select the desired lifeline in the Model View or the Diagram View.
  3. In the Object Inspector, select the represents field.
  4. Click the chooser button.
  5. In the Choose Represented Connectable Element dialog box, select the desired part from the project or Favorites.
  6. Click OK.

To associate a lifeline with a type:

  1. Select the desired lifeline in the Model View or the Diagram View.
  2. In the Object Inspector, select the type field.
  3. Click the chooser button.
  4. In the Choose Represented Connectable Element's type dialog box, select the class that defined the type from the project or Favorites.
  5. Click OK.

To define decomposition for a lifeline:

  1. Select the desired lifeline in the Model View or the Diagram View.
  2. In the Object Inspector, select the decomposition field.
  3. Click the chooser button.
  4. In the Choose Referenced Interaction dialog box, select the desired interaction from the project or Favorites.
  5. Click OK.

    Tip: Decomposition, type, stereotype, and referenced element properties are also reflected in the corresponding Communication diagram.

See Also