Documente Academic
Documente Profesional
Documente Cultură
Object Orientation
Encapsulation
Abstraction
Modularity
Hierarchy
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 1
What is Encapsulation?
Hide implementation from clients
Clients depend on interface
Improves Resiliency
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 2
What is Modularity?
The breaking up of something complex into
manageable pieces
Order
Entry
Order Processing
System Order
Fulfillment
Billing
Manages Complexity
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 3
What is Hierarchy?
Levels of abstraction Asset
Increasing
abstraction
Truck
Conceptual entity
Chemical Process
: Professor
a + b = 10
ProfessorClark
Class Name Only
Professor Clark
ProfessorClark :
Professor Object Name Only
OO Principle: Abstraction
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 8
Sample Class
Class
Course
Properties Behavior
Name Add a student
Location Delete a student
a + b = 10
Days offered Get course roster
Credit hours Determine if it is full
Start time
End time
Professor
Professor Jones
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 10
What is Polymorphism?
The ability to hide many different
implementations behind a single interface
Manufacturer B
Manufacturer A Manufacturer C
OO Principle:
Encapsulation
Uses
Organize the model under development
OOAD Using the UML - Introduction to Object Orientation, v 4.2
<<subsystem>> Component
Component Name Name
Component Component
Interface Interface
Account
balance
name
Superclass number
(parent) Withdraw()
CreateStatement()
Generalization
Relationship
Checking Savings
Descendents
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 17
Example: Multiple Inheritance
A class can inherit from several other
classes
FlyingThing Animal
multiple
inheritance
Inheritance leverages the similarities among classes
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 19
Strengths of Object Orientation
A single paradigm
Facilitates architectural and code reuse
Models more closely reflect the real world
More accurately describe corporate data and
processes
Decomposed based on natural partitioning
Easier to understand and maintain
Stability
A small change in requirements does not mean
massive changes in the system under
development
OOAD Using the UML - Introduction to Object Orientation, v 4.2
Copyright 1998-1999 Rational Software, all rights reserved 20
A Simple Sales Order Example
Order
Product
Ship via
Sale