Class Diagram Article Index for
Class
Shopping
Diagram
Website Links For
Class
 

Information About

Class Diagram





CLASSES


A Class in the software system is represented by a box with the name of the class written inside it. A compartment below the class name can show the class's ''attributes'' (i.e. its ''properties''). Each ''attribute'' is shown with at least its name, and optionally with its type, initial value, and other properties.

The class's ''operations'' (i.e. its Methods ) can appear in another compartment. Each ''operation'' is shown with at least its name, and optionally also with its parameters and return type.

Attibutes and operations may have their visibility marked as follows:
  • "+" for ''public''

  • "#" for ''protected''

  • "−" for ''private''

  • "~" for ''package''



RELATIONSHIPS

UML has the following relationships shown on a class diagram.


Generalization


The graphical representation of a Generalization (also '' Inheritance '' or ''"is a" relationship'') is shown as a Triangle shape on the Superclass end (also known as ''parent'' or ''base class'') of the tree of lines that interconnect one or more Subclass es (''child'' or ''derived class'') to their superclass(es). Any Object that is an Instance of a subclass is also an instance of the superclass.


Association

Associations are drawn between classes but represent relationships among objects. The ''role'' of an object in the relationship can be specified on an ''association-end'' as well as the ''multiplicity'' (the number of objects that participate in the association). Common multiplicities are:


Aggregation, Composition


Aggregation and Composition are both sub-variants of the '' HAS-A relationship''. They are special forms of Associations.

'' Aggregation '' occurs when a class is formed as a collection or container of other classes without a strong life cycle dependency of their instances. Its graphical representation is a ''clear'' Diamond Shape on the containing class end of the tree of lines that interconnect contained classes to the containing class.

'' Composition '' — in contrast — connotes a strong life cycle between objects of the container class and objects of the contained classes: If the container is destroyed, any contained objects are also destroyed. The graphical representation of Composition is a ''black'' diamond shape on the containing class end of the tree of lines that interconnect contained classes to the containing class.


EXTERNAL LINKS