Class diagrams are an aspect of UML that describe a static design of the objects, and their relationships to each other, in an application. During analysis, class diagrams may just be the names of objects and how they interact, but as the design develops the details of each class, including attributes and methods, are displayed in the diagram.

A class is represented by a rectangle divided into three rows. The top row contains the name of the class. The middle row lists the attribute names, while the third row lists the method names for the class.

There are two major relationships that can exist between classes: inheritance and association. Inheritance, also know as generalization, describes a superclass/subclass relationship. An empty arrow that points from the subclass to the superclass represents a generalization relationship.

A line joining two classes represents associations. This association represents a relationship between instances of each class. In an association, one class uses a member of a second class. There are specialized associations, which are aggregation and composition. Aggregation represents a stronger relationship between two objects, and it describes a "has-a" relationship. A white diamond is at the end of the line that points to the class that holds the other class. Composition is a relationship that exists between classes when an instance of one class cannot exist without an instance of a container object. With composition, a black diamond points towards the container class and an arrow points to the contained class.

Class diagrams also contain specific notations about how to describe attributes and methods in the class objects. They also contain information about multiplicity, which indicates how many of each object may be involved in a relationship. Other objects, such as abstract classes, packages, interfaces, and stereotypes, may be represented in a class diagram as well. Overall, class diagrams are used to create a standardized design of the system from the requirements.

Author: Laurie Williams and Sarah Heckman
Maintained By: Sarah Heckman
Last Updated: 2008-08-14