Guide to UML Class Diagrams

November 17, 1999

A Basic Guide to UML Class Diagrams

This simple guide shows the basic representations used in UML class diagrams, including all the elements used in the article examples.


A class is drawn as a rectangle with three compartments: the first compartment shows the name of the class, the second compartment shows the attributes of the class and the last compartment shows the methods of the class.


The relationships between two classes can be of the following three types:

  • Association
  • Aggregation
  • Dependency

An Association is a bi-directional connection between classes (e.g. the "hires/works for" relationship between an "employee" class and a "boss" class). It is represented by a solid line.

An Aggregation is the relationship between the whole and its parts. An aggregation is represented as a line connecting the related classes with a diamond next to the class representing the whole.

A Dependency is a relationship where the client does not have semantic knowledge of the supplier. It can be used, for example to show the relationship between an "encoder" class and a "genericAlgorithm" class that is inserted in runtime to help it encode a stream. A dependency is shown as a dashed line pointing from the client to the supplier.

Finally there is Inheritance. Inheritance is represented by a line ending on a triangle on the parent class.

The following example illustrates the concepts above