Mastering Object-Oriented Analysis and Design With UML
Mastering Object-Oriented Analysis and Design With UML
Physical entity
Truck
Conceptual entity
Chemical Process
Software entity
Linked List
Name: J Clark
Employee ID: 567138
HireDate: 07/25/1991
Status: Tenured
Discipline: Finance
MaxLoad: 3
Name: J Clark
Employee ID: 567138
Date Hired: July 25, 1991
Status: Tenured
Discipline: Finance
Maximum Course Load: 3 classes Professor Clark
()
C ou
es
rs
ad
eO
Gr
f fe
rin
al
g(
in
)
itF
bm
Su
Se
tM
ax
Professor Clark’s behavior
Lo
ad
Submit Final Grades
()
Accept Course Offering TakeSabbatical()
Take Sabbatical
Maximum Course Load: 3 classes Professor Clark
Mastering Object Oriented Analysis and Design with UML
Copyright © 2003 Rational Software, all rights reserved 11
An Object Has Identity
Each object has a unique identity, even if
the state is identical to that of another
object.
Named Object
: Professor
Professor J Clark
Unnamed Object
<<stereotype>> Stereotype
Class
Object Orientation
Encapsulation
Modularity
Hierarchy
Abstraction
Student Professor
Improves Resiliency
Mastering Object Oriented Analysis and Design with UML
Copyright © 2003 Rational Software, all rights reserved 18
Encapsulation Illustrated
Professor Clark Professor Clark
needs to be able Ac
to teach four ce
()
pt
Co
es
ur
classes in the
ad
se
Gr
O ffe
al
r
next semester. ing
in
()
itF
Name: J Clark
m
Employee ID: 567138
b
Su
HireDate: 07/25/1991
Status: Tenured
Se
Discipline: Finance
SetMaxLoad(4)
tM
MaxLoad:4
axL
oa
d()
TakeSabbatical()
Course
Catalog
System
Course Registration
System Student
Management
System
Class
+ attribute
+ operation()
Professor
- name
- employeeID : UniqueID
- hireDate
- status
- discipline
- maxLoad
+ submitFinalGrade()
+ acceptCourseOffering() Professor J Clark
+ setMaxLoad()
+ takeSabbatical()
Student
- name
- address
Attributes - studentID
- dateOfBirth
Student
+ getTuition()
+ addSchedule()
Operations + getSchedule()
+ deleteSchedule()
+ hasPrerequisites()
Manufacturer B
Manufacturer A Manufacturer C
OO Principle:
Encapsulation
Mastering Object Oriented Analysis and Design with UML
Copyright © 2003 Rational Software, all rights reserved 28
Example: Polymorphism
financialInstrument.getCurrentValue()
ge ge ge
tC tC tC
ur ur ur
re re re
nt nt nt
V alu Va V alu
lu
e( e( e(
) ) )
Tube
<<interface>>
Shape
Pyramid
+ draw()
+ move()
+ scale()
+ rotate()
Cube
Realization relationship
(stay tuned for realization relationships)
Mastering Object Oriented Analysis and Design with UML
Copyright © 2003 Rational Software, all rights reserved 30
How Do You Represent an Interface?
Elided/Iconic Tube
Representation
(“lollipop”) Pyramid
Shape
Cube
Canonical <<interface>>
Tube
(Class/Stereotype) Shape
Representation Pyramid
+ draw()
+ move()
+ scale()
+ rotate() Cube
UniversityArtifacts
<<subsystem>>
SubsystemName
Interface1
<<DLL>>
A run time component Component
Component
Name
Interface
<<EXE>>
OO Principle: Encapsulation
Mastering Object Oriented Analysis and Design with UML
Copyright © 2003 Rational Software, all rights reserved 34
Subsystems and Components
Components are the physical realization of
an abstraction in the design
Subsystems can be used to represent the
component in the design
Design Model Implementation Model
<<subsystem>>
Component
Component Name
Component Name
Component
Interface
Interface
<<Entity>> <<Entity>>
Professor + instructor CourseOffering
0..1 0..*
Zero or More *
Whole Part
1 0..1
<<Control>>
RegistrationController
<<Entity>> <<Entity>>
Schedule CourseOffering
Dependency
relationship
Component Client Supplier
Dependency
relationship
Savings Checking
Subclass
(Child)
(Descendents)
Mastering Object Oriented Analysis and Design with UML
Copyright © 2003 Rational Software, all rights reserved 45
Example: Multiple Inheritance
A class can inherit from several other classes.
FlyingThing Animal
Multiple Inheritance
generalization
Subclass
(Child)
Class
Interface
<<subsystem>>
Subsystem Interface