Class Diagrams

Class diagrams are the most important diagrams of all other UML diagrams. The class diagrams are not only widely used but also covers highest range of modeling concepts.

Class diagrams describe the types of objects in the system, features of the objects and the static relationships that exists between the objects.


Class: A rectangle divided into three sections. The top section is the name of the class. The middle section defines the properties of the class. The bottom section lists the methods of the class; denotes class in object oriented programming.

Attribute: Describes a property as a line of text with in the class box itself. The full form of an attribute is: visibility name: type multiplicity = default {property-string}

Association: A solid line with or without an arrow between two classes; denotes a relationship between two classes, can also feature multiplicity rules. Association is the other way to notate a property.
Multiplicity: The multiplicity of a property is an indication of how many objects may fill the property.
1 : Only one object
0..1 : Zero or one object
* : Zero or many objects

Operation: Operations are the actions that a class carries out. Operations correspond to the methods in a class. The full syntax of an operation is : visibility name(parameters list) : return-type {property-string}

Generalization: A line with hollow arrow head points to a base or parent class; denotes the inheritance in OOP.

Aggregation: A line with hollow diamond head points to a class that aggregates the classes.

Composition: A line with solid diamond head points to a class that the classes are part of it.

Dependency: A dashed arrow line, denotes dependency between a supplier class and a target class.

Stereotype: A stereotype is used to extent any existing UML elemet. A stereotype is rendered as a name enclosed by guillemets and placed above the name of another element.

Notes and Comments: A comment text attached to any element with a dashed line.

When to use?

Class diagrams are the essential part of the software design, your will find yourself using them all the time.
Domain modeling(Conceptual class diagrams).
Implementation modeling.

Who develops it?

Domain Experts(Conceptual).
Developers & Software Architects.


Following example shows patient, doctor and appointment classes and their associations.

Further readings:

Applying UML and Patterns --Larman
UML Distilled -- Martine Fowler
The Unified Modeling Language User Guide --Grady Booch , James Rumbaugh , Ivar Jacobson

Next >>

You can view this article online at: