uml class diagram g-3-122139
TRANSCRIPT
GROUP - CUML CLASS DIAGRAM
• 122065• 122109• 122139• 122141
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?
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 interfaceshould not include inherited methods
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.00Method + distance(p1: Point, p2: Point): double
Displays • inheritance between classes• interface implementationArrow Styles• class: solid line, black arrow• abstract class: solid line, white
arrow• interface: dashed line, white
arrow
RELATIONSHIPS - GENERALIZATION
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 *
Multiplicity• One to One
• One to Many
RELATIONSHIPS - ASSOCIATION
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
Aggregation : Has a - relationship
RELATIONSHIPS - ASSOCIATION
1 1
Car
aggregation
Engine
Composition: Is composed of - relationship
RELATIONSHIPS - ASSOCIATION
Page
Book
composition
* 1
• Violet (free) – http://horstmann.com/violet/
• Rational Rose – http://www.rational.com/
• Visual Paradigm UML Suite (trial)
TOOLS
• 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
THANK YOU