1. GROUP - C
UML CLASS DIAGRAM
• 122065
• 122109
• 122139
• 122141
2. UML class diagram:
a picture of
• the classes in an OO
system
• their fields and methods
• connections between
the classes
that interact or inherit
from each other
Not represented in a
UML class diagram:
• details of how the
classes interact with
each other
• algorithmic details; how
a particular behavior is
implemented
WHAT IS A CLASS DIAGRAM?
3. A CLASS
Class Name
Attributes
Methods
write <<interface>> on top of interfaces' names
use italics for an abstract class name
should include all fields of the object
omit trivial (get/set) methods
don't omit any methods from an interface
should not include inherited methods
4. visibility:
• + public
• # protected
• - private
• ~ package (default)
• / derived
ATTRIBUTES AND METHODS
• underline static
attributes/methods
• parameter types listed as
(name: type)
• omit return type on
constructors and when return
type is void
Attribute - balance : double = 0.00
Method + distance(p1: Point, p2: Point): double
5. Displays
• inheritance between classes
• interface implementation
Arrow Styles
• class: solid line, black arrow
• abstract class: solid line, white arrow
• interface: dashed line, white arrow
RELATIONSHIPS -
GENERALIZATION
6. Displays a usage relationship
There are three parts of an Association :
• Multiplicity : How many are used
• Name : what relationship the objects have
• Navigability : Direction
There are three types of Associations :
• Dependency
• Aggregation
• Composition
RELATIONSHIPS -
ASSOCIATION
Customer Order
1 *
8. Dependency :
• A using relationship between two
classes
• A change in the specification of
one class may affect the other
• But not necessarily the reverse
RELATIONSHIPS -
ASSOCIATION
Dependent Employee
dependency
9. Aggregation :
Has a - relationship
RELATIONSHIPS -
ASSOCIATION
1
1
Car
aggregation
Engine
11. • Violet (free) – http://horstmann.com/violet/
• Rational Rose – http://www.rational.com/
• Visual Paradigm UML Suite (trial)
TOOLS
12. • Can be used to discover related data and attributes
• Gives a quick picture of the important entities
• Shows whether you have too few/many classes, whether
the relationships between objects are too complex, etc.
• Spots dependencies between one class/object and
another
BUT
• Not data-driven
• Do not display the control flow
PROS AND CONS