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. With Visual Paradigm Desktop, 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 System Design> UML > Class Diagram from the welcome page.
    Select Diagram > New > Class Diagram from the toolbar.

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

  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 Order respectively.

  3. Create operations in Order class by right-clicking the class and select Add > Operation.

  4. Operations starting with the + sign are public operations. It can be called by all classes. Whilst the ones starting with the – sign are private operations. It can be called by its belonging class only.

  5. 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 Order class.

  6. Create a sequence diagram by one of these 3 methods listed below:
    Select System Design> UML > Sequence Diagram from the welcome page.

    Select Diagram > New > Sequence Diagram from the toolbar.

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

  7. 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. Then Ordercontroller lifeline and Order lifeline will be created subsequently.

  8. 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.

  9. 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 Order lifeline. Repeat the same action for creating a message between OrderController and Order.

  10. Operations of the receiver of the message are listed for choosing. Note that only public operations can be shown since the accessibility of private operations are limited to only its belonging class.

  11. Create a messages setOrderNumber between OrderController and Order.
    Create message SetOrderNumber

  12. 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

  13. 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

  14. The new operation, setOrderNumber() is automatically created and the change is reflected on the class diagram too.

  15. In case parameter is needed to be passed into the operation when it is called, make changes to its signature.

  16. The signature in the class diagram will also be changed as a result.

47 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply