User Defined Types  «Prev  Next»
Lesson 10 Drawing a class diagram
Objective Define all class data for the Checkbook Manager program.

Drawing a Class Diagram

Earlier in this module, you defined and created a class diagram for the Check class. To develop a complete design specification, you need to define all the classes that will exist in your Checkbook Manager program. Therefore, the next step in your course project is to take a look at the real-world entities that you listed, define the classes, and create class diagrams for the classes you have defined.
The class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system. It contains the classes of the system, their attributes, operations and the relationships among the classes. The class diagram is the main building block of object oriented modeling. It is the most common starting point for software architects and developers when designing a system.

Class Diagram

The class diagram is a static diagram and represents the static view of an application and is not only used for describing and documenting different aspects of a system, but also for constructing executable code of the software application.
The class diagram describes the attributes and operations of a class as well as the constraints imposed on the system. Class diagrams are widely used in the modeling of object oriented systems because they are the only UML diagrams which can be mapped directly with object oriented languages.
The class diagram shows a collection of
  1. classes,
  2. interfaces,
  3. associations,
  4. collaborations and
  5. constraints.
Ad Object-Oriented Analysis


The purpose of the class diagram is to model the static view of an application. Class diagrams are the only diagrams which can be directly mapped with OO languages and thus widely used at the time of construction.
UML diagrams like the activity diagram and sequence diagram can only give the sequence flow of the application. However, a class diagram is a bit different and is the most popular UML diagram in the developer community.
So the purpose of the class diagram can be summarized as:
  1. Analysis and design of the static view of an application.
  2. Describe responsibilities of a system.
  3. Base for component and deployment diagrams.
  4. Forward and reverse engineering.

How to draw Class Diagram?

Class diagrams are the most popular UML diagrams used for construction of software applications. So it is very important to learn the drawing procedure for class diagram. Class diagrams have properties to consider while drawing but here the diagram will be considered from a top level view. A class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application. So a collection of class diagrams represent the whole system. The following points should be remembered while drawing a class diagram:
  1. The name of the class diagram should be meaningful to describe the aspect of the system.
  2. Each element and their relationships should be identified in advance.
  3. Responsibility (attributes and methods) of each class should be clearly identified.
For each class minimum number of properties should be specified. Because unnecessary properties will make the diagram complicated.
Use notes when ever required to describe some aspect of the diagram. since at the end of the drawing it should be understandable to the developer.
Finally, before making the final version, the diagram should be drawn on plain paper and rework as many times as possible to make it correct.

Drawing Class Diagram - Exercise

Click the Exercise link below to define all the classes for your Checkbook Manager program.
Drawing Class Diagram - Exercise

SEMrush Software