Jump to Menu

How to Draw UML Sequence Diagram?

When you want to model the structure of a system or an application, you can make use of class diagram. When you want to model the interaction between objects in runtime, with the sequence of method invocation, you can make use of sequence diagram. Class diagram and sequence diagram can be related with each other. While a class in class diagram represents a blueprint of data, a lifeline in sequence diagram represents an instance of such blueprint. In this tutorial, we will start from a simple class diagram, and make use of a sequence diagram to model the dynamic method invocation related to a controller class modeled in class diagram.

Compatible edition(s): Enterprise, Professional, Standard, Modeler

  • March 16, 2016
  • Views: 116,082
  • PDF

Creating a Sequence Diagram from a Class

  1. Download Simple-Registration.vpp. You can also find this file at the bottom of this tutorial.
  2. Open the downloaded .vpp file in Visual Paradigm. To open a project, select Project > Open from the application toolbar.
  3. Open the class diagram Registration. Study the diagram content. We have three classes - RegistrationUI, RegistrationController and User.
    UML class diagram
  4. Now, we want to model the interaction between object instances of these classes in runtime. Since the controller class is responsible to control the registration process, add a sub-sequence diagram from it. Move the mouse pointer to RegistrationController. Click on the resource icon at the bottom right corner and select New Diagram... from the popup menu.
    New sub-diagram from class
  5. In the New Diagram window, select Sequence Diagram and click Next. Keep the diagram name as provided and click OK to confirm. This creates an empty UML sequence diagram.
    Select sequence diagram

Drawing the Sequence Diagram

  1. Select Boundary Lifeline (B) from the diagram toolbar.
    Select lifeline
  2. Click on the diagram to create a boundary lifeline.
    Boundary lifeline created
  3. Enter registrationUI as the name of lifelife and then press Enter to confirm.
    Lifeline named
  4. Right-click on the lifeline and select Select Class > Select Class... from the popup menu.
    Select class for lifeline
  5. In the Select Class window, select the RegistrationUI class and then click OK to confirm.
    Select class
    After that, the lifeline will look like the following.
    Class selected
  6. Create a Control Lifeline registrationController : RegistrationController and an Entity Lifeline user : User. Don't forget to select the appropriate classes for them. The diagram will look like the following.
    Three lifelines created
  7. Let's model the method invocations between lifelines. Move the mouse pointer over lifeline registrationUI.
    Mouse over lifeline
  8. Press on the Resource Catalog resource and drag it out.
    Create message
  9. Move to lifeline registrationController and release the mouse button.
    To release mouse button
  10. Select Message from Resource Catalog.
    Select message in Resource Catalog
  11. This pops up a list of name that you can choose for the new sequence message. You can see that those are operation of classRegistrationController. Select createUser(name, password).
    Operation selection
  12. Relate lifeline registrationController and user. We say that registrationController creates the user lifeline. Therefore, we need to relate them with a create message. Move the mouse pointer over the activation in lifeline registrationController.
    Mouse over activation
  13. Press on the resource Resource Catalog and drag it out.
  14. Release the mouse button on the lifeline user.
  15. Select Create Message from Resource Catalog.
    Create create message
    Create message is created. Your diagram should look like this:
    Create message created
  16. Create messages setName and setPassword from lifeline registrationController to user. Up to now, the diagram becomes:
    Sequence messages created
  17. You can also specify the arguments of operations. Take the message createUser(name, password) as example. Right-click on it and select Open Specification... from the popup menu.
    Opening message specification
  18. Edit the action type property by clicking on the button with dotted caption, next to Action type.
    Edit action type
  19. In the Call Action Specification window, click Add > Text... to add an argument. In this example, click Add > Text... to add argument peter. Click Add > Text... again to add argument mypwd. Note that the two arguments are actually referring to the two parameters given by the operation. If you add the third argument here, it will be ignored (as there are only two operations defined).
    Arguments defined
  20. Click OK to close the windows and go back to diagram. The arguments are added and presented on diagram. Finally the diagram become:
    Final UML sequence diagram



Turn every software project into a successful one.

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK