Share Models between Class Diagram and Sequence Diagram

A class diagram shows a set of classes, interfaces and their relationships and illustrates the static design view of a system, while a sequence diagram shows the sequence of actions that occurs in a system and illustrates the dynamic view of a system. Within VP products (e.g. VP-UML and Agilian, etc.), you can easily share the models between class diagram and sequence diagram. The changes that made in the sequence diagram can be automatically added to the class diagram as well and vice versa.

  1. Create a class diagram by one of these 3 methods listed below:
    Select File > New Diagram > UML Diagrams > Class Diagram from the main menu.

    Create a class diagram from the main menu

    Create a class diagram from main menu

    Select UML > Class Diagram from the toolbar.

    Create a class diagram from toolbar

    Create a class diagram from toolbar

    Right click on the Class Diagram on the Diagram Navigator and select New Class Diagram from the pop-up menu.

    Create a class diagram through Diagram Navigator

    Create a class diagram through Diagram Navigator

  2. Draw two classes by selecting the Class icon on the diagram toolbar and clicking it on the diagram. Rename the classes as OrderController and Orderrespectively.

    Create OrderController and Order

    Create OrderController and Order

  3. Create an association link between the two classes by selecting the Association icon on the diagram toolbar and dragging it from OrderController class to the Orderclass.

    Link from OrderController to Order

    Link from OrderController to Order

  4. Create a sequence diagram by one of these 3 methods listed below:
    Select File > New Diagram > UML Diagrams > Sequence Diagram from the main menu.

    Create a sequence diagram from main menu

    Create a sequence diagram from main menu

    Select UML > Sequence Diagram from the toolbar.

    Create a sequence diagram from toolbar

    Create a sequence diagram from toolbar

    Right click on the Sequence Diagram on the Diagram Navigator and select New Sequence Diagram from the pop-up menu.

    Create a sequence diagram through Diagram Navigator

    Create a sequence diagram through Diagram Navigator

  5. Drag the OrderController class and Order class from the Diagram Navigator under the Class Diagram tree and drop them on the sequence diagram. Choose Lifeline from the pop-up menu and then Ordercontroller lifeline and Orderlifeline will be created subsequently.

    Drag and drop classes on sequence diagram

    Drag and drop classes on sequence diagram

  6. Add an actor to the sequence diagram by choosing the Actor icon on the diagram toolbar and then click on the diagram. Rename the actor as Clerk.

    Create a Clerk actor

    Create a Clerk actor

  7. Create a message from actor to the lifeline by choosing on the Message icon on the diagram toolbar and dragging it from Clerk actor to Orderlifeline. Repeat the same action for creating a message between OrderController and Order.

    Two messages are created

    Two messages are created

  8. Rename both messages as setOrderNumberby double-clicking on each message.

    Rename two messages as SetOrderNumber

    Rename two messages as SetOrderNumber

  9. To set Call type for a message, move the mouse over the target message, click the Message Type resource icon and select Call > Call from the pop-up menu.

    Select a Call message type

    Select a Call message type

  10. To select an operation for the Call type message, right click on the message and select Select Operation > Create Operation “setOrderNumber”from the pop-up menu.

    Create operation for message

    Create operation for message

  11. Finally, go back to the class diagram, a new operation, setOrderNumber()is automatically created.

    Operation is created on Order class

    Operation is created on Order class

47 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply