This tutorial has been retrieved from Google and the Web Archive after the original site disappeared. The Web link to the Dia homepage has been updated.

A UML tutorial

I couldn't find a tutorial on the web on how to use UML in an actual design. So I will share with you my bad grammar along with my experience on my first UML design.

You can probably use a graphic tool to create UML designs. However I'd recommend a tool created with UML in mind. It will save you a lot of grief. I'm using a free-as-in-freedom tool named dia. I'm not using the latest version, but the 0.2 version seems to work ok, except for the EPS output which I don't particularly like.

The basics

A class diagram allows you to document how the class relates to other classes. The class diagram doesn't fix the actual implementation. The actual code might not be a direct translation of the diagram. However the functionality of the code will remain the same. In the following figure you can observe the following:

  • Class A is a class which has some attributes (variable) and functions (function).

  • Class A is the parent class of Sub-Class

  • Class A is associated with Class B. In this case only 1 Class B is associated with possibly multiple versions of Class A. The association is named something. Depending on the type of UML diagrams you are using, something can be implemented using a variable or by something else.

  • Class T is a template class. In C++ it would be defined by something like template <class T> Class_T { ... }

  • Class B is an instance of Class T where the parameter T is binded to int.

  • General is a class that can add attributes (or function) to the association between Class A and Class B. In the present case, it adds the variable period.


The above diagram shows the logical relationship between the components. It doesn't mean that a C++ class would be implemented using all the 5 classes represented here. Short cuts can be taken. However, the logical structure must remain the same. For example, you can move period outside of the General class and inside the Sub-Class. But the logic of the association remains the same.

The problem

I'm working on the Altima project and for it I want to create an isometric editor that can create worlds. It was decided that everything on the Altima world would be an entity. Using polymorphism, behavior can be added to the basic entity model. My problem is to define an entity that is usable by the server and the iso client.

The simplified requirements are:

  • An entity has a unique id.
  • An entity has a bounding volume.
  • An entity has a graphic associated with it.
  • An entity has some general information associated with it.
  • A container contains multiple entities. A room would contain a bed, a table, a chair, a dresser, a chest, a lamp, etc.
  • An entity (such as a player) can move from container to container.

The UML designs

To solve the above problem I started to design using UML. The first and second try introduce new UML particularities and the latest one tries to split and simplify the diagrams.

  1. Dia/UML Tutorial/Draft - The draft design: based on the C++ code that was there at the time.

  2. Dia/UML Tutorial/Second design - The second design: a design that addresses the shortcomings of the first draft.

  3. Dia/UML Tutorial/Third design - The third design: adds functionality and tries to simplify the entity diagram.

Lavoie Philippe

Created: Thu Jan 14 11:26:04 EST 1999 Last modified: Mon Jan 18 15:43:57 EST 1999

Apps/Dia/UML Tutorial (last edited 2013-08-09 00:08:16 by WilliamJonMcCann)