Académique Documents
Professionnel Documents
Culture Documents
ObjectOrientedDesign
Dumitru Radoiu
DumitruRadoiu
Spring2009
PETRU MAIOR UNIVERSITY
Agenda
TheCharacteristicsofObjectOrientedDesign(OOD)
The
Characteristics of Object Oriented Design (OOD)
TheUseofClassesinOOD
TheuseofInheritanceinOOD
TheUseofPolymorphisminOOD
CreatingaClassDiagram:CaseStudy
time
Analysis
= attempt to
understand
Design
= model the
behavior
Implementation
= implement
the model
Exclusions
Deliverables
Needs
Baseline
Requirements
Specifications
Implementation
time
Design
Analysis
= attempt to
understand
= model the
behavior
Edit Data
Implementation
= implement
the model
Load Data
Deliverables
Needs
Requirements
Pi tD
Print
Data
t
Save Data
View Data
Everythingisexposed;
Everything
is exposed;
updatingbusinessrulesdoes
notupdatetheentire
application.
time
Design
Analysis
= attempt to
understand
= model the
behavior
Implementation
= implement
the model
Deliverables
Needs
Requirements
Data
Functionality
Functionalitiesare
Functionalities
are
encapsulated;onlysomeare
exposed(Interfaces)
time
Design
OO Analysis
= what abstract
entities/objects are
required to future
system?
= model the
behavior
Implementation
= implement
the model
Deliverables
Needs
Requirements
Data
Functionality
Object
Functionalitiesare
Functionalities
are
encapsulated;onlysomeare
exposed(Interfaces)
time
OO Design
OO Analysis
= what abstract
entities/objects are
required to future
system?
= model the
behavior for
the system to
exist
Implementation
= implement
the model
Deliverables
Needs
Requirements
Data
Functionality
Object
time
OO Design
OO Analysis
= what abstract
entities/objects are
required to future
system?
= model the
behavior for
the system to
exist
OO Programming
Deliverables
Needs
Requirements
Data
Functionality
Object-Oriented World
time
OO Analysis
Create the
vocabulary
Requirements
OO Design
Give
vocabulary
ocabu a y
behavior
(model the
system)
OO Programming
Program the
model
ode
Deliverables
Object-Oriented Design
time
OO Analysis
Create the
vocabulary
Requirements
OO Design
Give
vocabulary
ocabu a y
behavior
(model the
system)
OO Programming
Program the
model
ode
Principles:
1. Classes (abstraction and encapsulation)
2. Inheritance
3. Polymorphism
Deliverables
Agenda
TheCharacteristicsofObjectOrientedDesign(OOD)
The
Characteristics of Object Oriented Design (OOD)
TheUseofClassesinOOD
TheuseofInheritanceinOOD
TheUseofPolymorphisminOOD
CreatingaClassDiagram:CaseStudy
plane
ship
automobile
truck
A____isatypeof____.
car
SUV
What makes a class: encapsulation ( = stuff the item with data and functionality)
name
data
functionality
black box
name
data
input
output
functionality
Interface=restrictedaccesstofunctionality=lower
maintenance&problemprevention
time
OO Design
OO Analysis
= what abstract
entities/objects are
required to future
system?
= model the
behavior for
the system to
exist
OO Programming
Deliverables
Needs
Requirements
Data
Functionality
time
OO Design
OO Analysis
= what abstract
entities/objects are
required to future
system?
= model the
behavior for
the system to
exist
Di l
Display
OO Programming
-Data
Needs
Requirements
Data
+Print()
+View()
-Data
+Save()
+Load()
Load()
Menu
-Data
+Create()
+Edit()
Deliverables
Agenda
TheCharacteristicsofObjectOrientedDesign(OOD)
The
Characteristics of Object Oriented Design (OOD)
TheUseofClassesinOOD
TheuseofInheritanceinOOD
TheUseofPolymorphisminOOD
CreatingaClassDiagram:CaseStudy
plane
ship
automobile
truck
car
SUV
Subclass A
Subclass B
Subclass C1
Subclass C
Subclass C2
Subclass C3
automobile
- Nr.OfWheels
Nr OfWheels
+Drive()
+Reverse()
+Park()
Park()
truck
-Nr.OfGears
- Nr.OfTanks
+ Tow()
+Load()
+Unload()
car
-TrunkSize
-SafetyWindows
SUV
-4WD
-BullBar
+ Trolley()
Multiple Inheritance
Weapon
Vehicle
-ArtileryCapacity
- ArtileryType
-FuelType
- SeatingCapacity
+Drive()
+Reverse()
+Park()
+Start()
+Stop()
+Load()
+Fire()
+Aim()
Tank
-Model
+ Ram()
+Radio()
Agenda
TheCharacteristicsofObjectOrientedDesign(OOD)
The
Characteristics of Object Oriented Design (OOD)
TheUseofClassesinOOD
TheuseofInheritanceinOOD
TheUseofPolymorphisminOOD
CreatingaClassDiagram:CaseStudy
Lion
+ Run()
+Sleep()
Bird
+ Fly()
+Sleep()
Polymorphism=classeswiththesameinterfaceoperateontheirdatadifferently
Agenda
TheCharacteristicsofObjectOrientedDesign(OOD)
The
Characteristics of Object Oriented Design (OOD)
TheUseofClassesinOOD
TheuseofInheritanceinOOD
TheUseofPolymorphisminOOD
CreatingaClassDiagram:CaseStudy
Astudentcanbeanundergraduatestudentoragraduatestudent
g
g
Anundergraduatestudentcanbeatypeoftutor
Atutortutorsastudent
Ateacherandaprofessoraretwotypesofinstructors
eac e a d a p o esso a e o ypes o s uc o s
Ateacherassistantcanassistaprofessorandateacher;ateacher
canbeassistedbyoneassistant,whileaprofessorcanbeassistedby
uptofiveassistants
Ateacherassistantisatypeofgraduatestudent
U d
Undergraduate
d t
G d t
Graduate
U d
Undergraduate
d t
G d t
Graduate
Student
T t
Tutor
U d
Undergraduate
d t
G d t
Graduate
Student
T t
Tutor
Instructor
U d
Undergraduate
d t
G d t
Graduate
Teacher
Professor
Ateacherassistantcanassistaprofessorandateacher;ateachercan
b
beassistedbyoneassistant,whileaprofessorcanbeassistedbyup
i db
i
hil
f
b
i db
tofiveassistants
tutors>
Student
T t
Tutor
Instructor
U d
Undergraduate
d t
G d t
Graduate
Teacher
Professor
1
0..1
0..4
TeacherAssistant
Ateacherassistantisatypeofgraduatestudent
tutors>
Student
Instructor
Tutor
Undergraduate
Graduate
Teacher
Professor
1
0..1
0..4
TeacherAssistant
Project
Readthefollowingscenarioandperformtherequiredactivities:
Theassignedprojectrequirestobuildanonlinestorewiththe
followingcharacteristics:
Customerscanbuydifferentphysicalobjectswhichwillbedelivered
f ll i
followingpayment
t
Paymentcanbemadeviacreditcard(arrangementswithathird
partyarealreadymade)
Activities:
1.
2
2.
3.
4.
5.
UsingBPMN(BusinessProcessModelingNotation)modelthebusiness
D
DrawtheUseCaseDiagramofasoftwaresystemwhichsupportsthebusiness
th U C
Di
f
ft
t
hi h
t th b i
DrawtheSequenceDiagramforeachUseCases
DrawtheActivityDiagramforeachUseCase
DrawtheClassDiagramsforthesystem