Professional Documents
Culture Documents
Ralph Tambala
MUST . CSIT
1 Overview
2 Class Diagram
Names
Attributes
Operations
3 Class Relationships
Association
Aggregation
Generalization
4 Practice Work
5 Additional Resources
Overview
1 The goal of this lecture is to cover the basics of designing Class
Diagrams using UML.
2 Everything that is not point 1 is not within the scope of this lecture.
3 Go to point 1. // its an infinite loop
Class Diagram
Class diagrams are the main building block in object-oriented
modeling. They are used to show the different objects in a system,
their attributes, their operations and the relationships among them.
A class is represented graphically as a rectangle, with its name,
attributes, and operations separated into distinct compartments.
Class diagrams help to construct the code for the software application
development.
Class Names
Class Attributes
An attribute is a named property of a class that describes the object
being modeled. In the class diagram, attributes appear in the second
compartment just below the class name compartment.
Class Operations
Operations describe the class behaviuor and appear in the third
segment. These are services the class provides.
Class Relationships
There are three basic categories of class relationships:
Association
Aggregation
Generalization
Association
Aggregation
Aggregation refers to the formation of a particular class as a result of one
class being aggregated or built as a collection. For example, the class
Library is made up of one or more books, among other materials. It is a
special type of association. It represents a “part of” relationship. In
aggregation, the contained classes are not strongly dependent on the
lifecycle of the container. For example in in Figure 11, class Book will
remain so even when the class Library is dissolved.
To show aggregation in a diagram, draw a line from the parent class to the
child class with a diamond shape near the parent class. What of
Composition?
Ralph Tambala (MUST . CSIT) Lecture 1 - Class Diagrams 13 / 17
Class Relationships Generalization
Generalization/Inheritance
Generalization or inheritance refers to a relationship in which one
associated class becomes a member of another by inheriting the parent
class’ functionalities. It represents an “is-a” relationship. In other words,
the child class is a subset of the parent class.
To show inheritance in a UML diagram, a solid line from the child class to
the parent class is drawn using an unfilled arrowhead as in Figure 12.
Ralph Tambala (MUST . CSIT) Lecture 1 - Class Diagrams 14 / 17
Practice Work
Practice Work
Additional Resources/Info