OOPortal OOPortal


Logical View  «Prev  Next»
Lesson 2 The class diagram
Objective Describe the Purpose and Function of the Class Diagram

Purpose and Function of the Class Diagram

Modeling elements

The class diagram/object model is the cornerstone of object-oriented (OO) modeling. The class diagram is the only OO model used to generate code and is the target for reverse engineering code into models.
The class diagram models classes, their component parts, and how they are related to one another. The class modeling elements include attributes, operations, stereotypes, properties, and associations. Associations may come in many variations, including simple, aggregation and generalization, qualified, and reflexive. Together these elements provide a rich set of tools for modeling software.

A blueprint

However, the class diagram is limited in what it can show us. Largely, it is a static view of the elements that make up the software. It is like a blueprint for a building or piece of machinery and you can see the parts used to make it and how they are assembled, but you cannot see how the parts will behave when they are set into motion. This is why we need other diagrams to model behavior and interactions over time, modeling the objects in motion.

Class diagram is at the center of 1) Use Case Model, 2) Object Diagram, 3) Sequence Diagram, 4) Collaboration Diagram, 5) Statechart Diagram, 6) Activity Diagram

Although other models are necessary, remember that their purpose is to support the construction and testing of the class diagram. Whenever another diagram reveals new or modified information about a class or object, the class diagram must be updated to include the new information.If this new information is not passed on to the class diagram, it will not be in your code.In the next lesson, you will learn how to describe attributes and operations for classes.