UML Diagrams
Class Diagram
O/R Mapping
Mac OS X
Tips and Tricks
VP Suite
Change Log

Sharing Model 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. Meanwhile, a sequence diagram shows the sequence of actions that occur in a system and illustrates the dynamic view of a system. Within this software, 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 any of these 3 methods listed below.
    Method 1- Creating a class diagram from the menu bar:

    On the menu, select File > New Diagram > UML Diagrams > Class Diagram. A new class diagram will be created.


    Method 2 - Creating a class diagram from the toolbar:

    Click on the New Class Diagram button from the toolbar. A new class diagram will be created.


    Method 3 - Creating a class diagram from the Diagram Navigator:

    1. Right click on the Class Diagram from the Diagram Navigator on the left side.
    2. Click on the Create Class Diagram from the pop-up menu. A new class diagram will be created.


  2. Draw two classes by choosing the Class icon on the diagram palette, select Class from the menu, then click anywhere on the diagram. Rename the classes by double-clicking on the newly created classes (For example OrderController and Order classes).


  3. Create an association link between the two classes by selecting the Association icon on the diagram palette, click on the OrderController class and then drag to the Order class.


  4. Create a sequence diagram by any of these 3 methods listed below.

    Method 1- Creating a sequence diagram from the menu bar:
    On the menu, select File > New Diagram > UML Diagrams > Sequence Diagram. A new sequence diagram will be created.


    Method 2 - Creating a sequence diagram from the toolbar:
    Click on the New Sequence Diagram button from the toolbar. A new sequence diagram will be created.


    Method 3 - Creating a sequence diagram from the Diagram Navigator:
    1. Right click on the Sequence Diagram from the Diagram Navigator on the left side.
    2. Click on the Create Sequence Diagram from the pop-up menu. A new sequence diagram will be created.


  5. Drag the OrderController class and Order class, from the Diagram Navigator under the Class Diagram tree, and drop to the newly created Sequence Diagram (New ordercontroller and order lifelines are automatically created).


  6. Add an actor to the sequence diagram by choosing the Actor icon on the diagram palette and then click on the diagram. Rename the actor as Clerk by double-clicking on the actor, then press Ctrl+Enter to finish the operation.


  7. Create a message from actor to the lifeline by choosing on the Message icon on the diagram palette, click on the actor and drag it to the lifeline. Repeat the same action for creating the message between lifelines.


  8. Rename both messages as setOrderNumber.


  9. Mouse over the message, click the Message Type resource and select Call as the message type.


  10. Right click on the message and select Select Operation... from the pop-up menu. A Select Operation dialog box is displayed.


  11. Click on the Create Operation... button from Select Operation dialog box to create an operation. A Operation Specification dialog box is displayed.


    Enter setOrderNumber in the Name field and then click on the OK button.


  12. Go back to the Class Diagram, a new operation, setOrderNumber() is automatically created.


Related Articles

Resources

 
 
Last modified: 2006/01/09 03:59
 
 
Home | Recent Topics | Highlights | UML Diagrams | Tips and Tricks | Object-Relational Mapping
visual-paradigm.com Home | Training Center | UML Center | VP Gallery | Discussion Forum | UML Open Directory