-
Notifications
You must be signed in to change notification settings - Fork 4
Tutorial
This section describes how to make a mixed diagram with classes, use cases, actors and notes. Here is the final diagram:
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:
- 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 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
- 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 in the toolbar
- Click on the class
Car
, then click on the classVehicle
Now we have our first relationship.
Using the same method, insert links:
- A Composition link from
Car
toWheel
. - An Aggregation link from the
Car
class to thePassenger
class. - A Note link between
Vehicle
and the note - An Association link 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 !