Skip to content

Tutorial

Humberto Sanchez II edited this page Feb 5, 2021 · 9 revisions

Tutorial

This section describes how to make a mixed diagram with classes, use cases, actors and notes. Here is the final diagram:

TutorialFinal

Start with a blank diagram File New or launch Pyut

The first step is to add the four classes to the diagram. Click on the class icon on the toolbar and place the Vehicle class in the top left corner. Now you should see the following class editor dialog:

ClassEditor-Vehicle

  • Set the class name to Vehicle and the stereotype toabstract.
  • Next, set the class fields. To do this, click on the first Add button and enter the
    • field name,
    • type
    • and a default value (for the example, 100.
  • Click Ok to return to the class editor.
  • Next, add the methodm emulating the field method.
  • You may also add a description to your class with the button Description....
  • Once you have entered all the parameters, click Ok to exit the class editor.

You should see your first class inyour diagram. Repeat the same steps to place the other three classes on the diagram.

Now we are ready to insert a note to describe the Vehicle class. Click the note tool ToolboxNote and place the note to the right of our class. Enter the note text and press Ok. You will see that you can not read the entire text in the note if the text is too long. Just resize the note to see all text.

We are now ready to place the actor and use cases to describe the interactions between users and the system.

  • Click on the actor tool ToolboxActor
  • Place it
  • Assign the actor a name

Add two use cases on the right of the actor, with a description of what the actor may do.

In this section, we are going to make links between the different components.

Class Car inherits from class Vehicle

  • Click on the inheritance link button ToolboxRelationshipInheritance in the toolbar
  • Click on the class Car, then click on the class Vehicle

Now we have our first relationship.

Using the same method, insert links:

  • A Composition link ToolboxRelationshipComposition from Car toWheel.
  • An Aggregation link ToolboxRelationshipAggregation from the Car class to the Passenger class.
  • A Note link ToolboxRelationshipNote between Vehicle and the note
  • An Association link ToolboxRelationshipAssociation between the Driver class and the two use cases.

We can redefine or remove link parameters by clicking the link.

This is a basic UML diagram. We can

  • Save it
  • Print it
  • Export it
  • And modify the different components by double-clicking on them.

You can now save a diagram using the default PyUt file format .put or use a plugin to export your diagram. The supported plugins are:

  • Import/Export XML
  • Import XMI
  • Import/Export Python (Reverse/Generation)
  • Import/Export Java (Reverse/Generation)
  • Export C++ (Generation)
  • Export BMP, JPG, PNG, or PDF

We showed that creating a UML class diagram with Pyut is easy !

Clone this wiki locally