Develop UML Sequence Diagram with UML Class

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.

June 14, 2010
User Rating: / 36
Views: 73,432
PDF Link Add comments

  1. Download the project file Simple-Registration.vpp attached with this tutorial.
  2. Start Visual Paradigm in a new workspace.
  3. Open Simple-Registration.vpp and open class diagram Registration. Study the diagram content. We have three classes - RegistrationUI,RegistrationController and User.
    open 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.
    add sub diagram
  5. In the New Diagram window, choose Suggested > Sequence Diagram.
    open sequence diagram
  6. This creates an empty sequence diagram. Select Boundary LifeLine (B) on the toolbar.
    select lifeline
  7. Click on the diagram to create a Boundary LifeLine.
    create lifeline
  8. Rename the lifeline.
    rename lifeline
  9. Right click on the lifeline and select Select Class > Select Class from the popup menu.
    open select class window
  10. In the Select Class window, select the corresponding class under Classes, then click OK to confirm.
    select class
  11. After that, the lifeline will look like the following.
  12. Create 2 more lifelines by repeating step 6-10. The diagram will look like the following.
  13. Let's model the method invocations between lifelines. Move the mouse pointer over lifeline registrationUI.
    model lifeline
  14. Press on the resource icon Message -> LifeLine
    message lifeline
  15. Move to lifeline registrationController and release the mouse button.
    move to lifeline
  16. 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).
    pop up list name
  17. 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.
    relate lifeline
  18. Select the resource icon Create Message -> Lifeline.
    message lifeline
  19. Move to lifeline user and release the mouse button.
    move to lifeline
  20. Create messages setName and setPassword from lifeline registrationController to user. Up to now, the diagram becomes:
    create messages
  21. The operations' parameters are not presented by default. To show them, right click on the background of diagram and select Presentation Options > Message Display Options > Show Messages Operation Signature from the popup menu. 
    show messages operation signatures
  22. The parameters are then presented.
    parameters presented
  23. We can specify the arguments as well. Take the message createUser(name, password) as example. Right click on it and select Open Specification... from the popup menu
    open specification
  24. Edit the action type property by clicking on the button with dotted caption, next to Action type.
    edit action type
  25. In the Call Action Specification dialog box, click Add to add an argument. In this example, click Add to add argument peter. Click Add 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 2 operations defined).
    add argument
  26. Click OK to close the dialog boxes and go back to diagram. The arguments are added and presented on diagram. Finally the diagram become:
    arfuments added


  1. Simple-Registration.vpp

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).

You may be interested in

  1. Data Flow Diagram (DFD) Tutorial
  2. Writing Effective Use Case
  3. Draw Entity Relationship Diagram (ERD)
  4. Data Flow Diagram with Examples - Food Ordering System
  5. Perform UML Modeling in NetBeans
Tags of this article:

Comments (16)

written by daniel on June 11, 2010

Hello, first great tutorial.
I have a question, when linking messaged I cant not see the parameter. For example I have createUser(name,password) however I dont see those parameters in the sequence diagram. how can I see the parameters in my sequence diagram.

Thank you for you help

written by Jick @ Visual Paradigm on June 14, 2010

Hi daniel,

That's a good question. We have added more steps (from step 16 onwards) to answer your question. If you have other questions, please feel free to post again.

Best regards,

written by FuShan on July 6, 2010

Dear Sir/Madam,

I have a question about the parameter. First, I right click the [Calss] and select [Add Template Parameter] and then finish it. later, I may find it is not useful. How can I delete the parameter in the Class diagram?

Thank you in advance

written by Tilly on July 6, 2010

Please find the following link to read how to remove parameter:

written by Maciej on April 8, 2011

Cannot find this option in my version, VP UML 8.0...

written by Jick Yeung on April 11, 2011

Hi Maciej,

Please right click at the background of diagram and select "Presentation Options > Message Display Options > Show Messages Operation Signature" from the popup menu.

Best regards,
Jick Yeung

written by Señor Oz on September 23, 2011

Hello, i can see that when you drag all the three classes, the program automatically assign a boundary lifeline, a control lifeline, and a entity lifeline, that is because the classes define the corresponding stereotype in the class diagram? and, i only can assign only these three kinds of stereotypes? Wath happend if i assig another kind of stereotype? Thanks for the answer.

written by Jick Yeung on September 23, 2011

Dear user,

Thank you for your post. You are correct that the boundary, control and entity lifelines are created due to the fact that the classes were assigned with boundary, control and entity stereotypes. You may assign any stereotypes you like to the lifelines. You may also create your own stereotypes and assign to lifelines. The name of assigned stereotypes will be shown in the lifeline shape.

Please feel free to contact me again if you have any questions.

Best regards,
Jick Yeung

written by Tuan Vu on November 15, 2011

if I download "Simple-Registration.vpp", I have zip file and after dezip, there are no *.vpp file!

written by Jick Yeung on November 15, 2011

Hi Tuan Vu,

Please rename the downloaded file to .vpp and try again.

written by Gibson Doepoh on October 26, 2012

Step 4, does not create Three Class automatically as you stated in Step 5, "This creates an empty sequence diagram. Open the Model Explorer, which is the tab next to Diagram Navigator. You can see the three classes listed there", you had to create those three new classes(boundary, control, entity) manually.

Take note, You can say,"You can see the three classes listed there", they need to be created.

written by Gibson Doepoh on October 26, 2012

Can you prove that the Three new Classes( boundary, control and entity) were created automatically as per the step in Step 5-6. or they were manually created, notice the icon difference in your classes in figure 5 and 6.


written by Jick Yeung (VP) on October 26, 2012

Hi Gibson,

The classes were created for you. Did you try with the project file we provided (step 1)? You can download it at the end of the tutorial. Inside the project you can find the controller, model and entity classes. You do NOT need to create them yourself.

written by Gibson Doepoh on October 28, 2012

Which version are you using, cause in the Standard Edition(Evaluation version Only) I am not seeing the Three classes icons in the Model Explorer window, thou there visible in the registration diagram display area.

written by Gibson Doepoh on October 28, 2012

// Not yet implemented, how to you execute "implementation", as regard the three classes in this tutorial, I attempted generating the code in PHP, using the EV edition, all the classed has this message, // Not yet implemented.

please send me detail on tutorial when in I can see classes and it implementatition.

written by Jick Yeung (VP) on October 29, 2012

Hi Gibson,

First of all, ALL editions and versions of VP-UML supports showing classes in Model Explorer. Did you set a filter which disallowed the classes to be shown in Model Explorer? If not, please send me your project file and a screenshot to our Ticket System.

About code generation, since the UML class models give just the schema level detail, we are unable to generate the logic inside method body and that's why the method bodies aren't implemented.

Write comment



Enter the calculation result

security code