Learn System Analyis and Design
UML-Class Diagram
   
Home
Class Diagram
UML
Use Case Diagram
Sequence Diagram
Collaboration Diagram
State Diagram
Activity Diagram
Component Diagram
Deployment Diagram
 
 

Class Diagram

Class diagrams are widely used to describe the types of objects in a system and their relationships. Class diagrams model class structure and contents using design elements such as classes, packages and objects.

The purpose of a class diagram is to depict the classes within a model. In an object oriented application, classes have attributes (member variables), operations (member functions) and relation-ships with other classes. The UML class diagram can depict all these things quite easily. Thefundamental element of the class diagram is an icon the represents a class.

A class icon is simply a rectangle divided into three compartments. The topmost compartment contains the name of the class. The middle compartment contains a list of attributes (member variables), and the bottom compartment contains a list of operations (member functions).

Below Figure a typical UML description of a class that represents a circle.

Each member variable is followed by a colon and by the type of the variable. If the type is redundant, or otherwise unnecessary, it can be omitted. Notice also that the return values follow the member functions in a similar fashion. Again, these can be omitted. Finally, notice that the member function arguments are just types.

Composition Relationships

Each instance of type Circle seems to contain an instance of type Point. This is a relationship known as composition. It can be depicted in UML using a class relationship. Below figure shows the composition relationship.

The black diamond represents composition. It is placed on the Circle class because it is the Circle that is composed of a Point. The arrowhead on the other end of the relationship denotes that the relationship is navigable in only one direction. That is,Point does not know about Circle. In UML relationships are presumed to be bidirectional unless the arrowhead is present to restrict them.

 

 

 
Publish Your Papers Here
We welcome papers on System analysis and design to be published here in this site. Authors can send their papers and brief description to learnsad@gmail.com. Plese include your profile picture

 

 
 
   
All rights reserved