Professional Documents
Culture Documents
29/09/2012
Object technologies
29/09/2012
Object-oriented programming
Data
Data
No
on hardware architecture
Branch
data still
Programmable
Source
Separation of
Subprograms/subroutines/functions/methods
Sequential execution
Conditional execution, loops, go to or branch to alter flow of
control
Subroutine call and return
Structured:
programming:
Object oriented
Service oriented
to OO
Introduced message
environment with
visual coding
Difficult to
Very
Microsystems
Syntax
Evolved
Ability to
Code
support change:
reuse
Creation of
Procedural approach:
Data
No
Object-oriented approach:
Data
The
This
12
13
Procedural approach
The concept of the business and the pieces of the business are lost.
OO approach
Allows the ability to more easily capture changes to the structure and to
the process.
14
Requirement:
Model
Procedural approach
Identify where
List the
Object approach
Identify what
15
Procedural
Objects
Reuse of code, writing functions once and using them again in other
objects (similar to procedural).
17
18
19
20
Procedural approach
Object-oriented approach
21
22
23
29/09/2012
Hierarchy
Modularity
Encapsulation
Abstraction
Object Orientation
What Is Abstraction?
24
29/09/2012
What is Abstraction?
Salesperson
Not saying
Which
salesperson
just a
salesperson
in general!!!
Customer
Product
Manages Complexity
25
29/09/2012
What Is Encapsulation?
on interface.
Improves Resiliency
26
29/09/2012
Encapsulation
27
What is Modularity?
Order
Fulfillment
Billing
Manages Complexity
28
29/09/2012
What is Hierarchy?
Levels of abstraction
Asset
Increasing
abstraction
Security
BankAccount
Savings Checking
Decreasing
abstraction
29
Stock
RealEstate
Bond
Object
Class
Attribute
Operation
Interface (Polymorphism)
Component
Package
Subsystem
Relationships
30
29/09/2012
What is an Object?
Conceptual entity
Software
Truck
Chemical Process
entity
Linked List
31
29/09/2012
Identity
32
29/09/2012
33
A person object
34
What is a Class?
relevant characteristics
other characteristics
OO Principle: Abstraction
35
29/09/2012
Name
The
Be singular
Not be too vague or general
List of messages
The
Sample Class
Class
Course
Properties
Name
Location
Days offered
Credit hours
Start time
End time
37
Behavior
Add a student
Delete a student
Get course roster
Determine if it is full
a + b = 10
29/09/2012
The
The
38
Professor
class name
structure (attributes)
- name
- employeeID : UniqueId
- hireDate
- status
- discipline
- maxLoad
behavior (operations)
+ submitFinalGrade()
+ acceptCourseOffering()
+ setMaxLoad()
+ takeSabbatical()
+ teachClass()
29/09/2012
Classes of Objects
39
29/09/2012
40
It
Professor Smith
41
Professor Jones
29/09/2012
What Is an Attribute?
Attributes
42
Student
- name
- address
- studentID
- dateOfBirth
29/09/2012
What Is an Operation?
Operations
43
+ get tuition()
+ add schedule()
+ get schedule()
+ delete schedule()
+ has prerequisites()
29/09/2012
What Is Polymorphism?
Manufacturer A
Manufacturer B
OO Principle:
Encapsulation
44
Manufacturer C
Remote Control
29/09/2012
Polymorphism
45
lets you substitute objects that have identical interfaces for each other at
run-time.
29/09/2012
What is an Interface?
Shape
Pyramid
Draw
Move
Scale
Rotate
Cube
Realization relationship
46
29/09/2012
Interface
How do you get an object to do useful work for you?
47
29/09/2012
What is a Package?
Uses
Organize the
A
48
OO Principle:
Modularity
What is a Subsystem?
Subsystem
<<subsystem>>
Subsystem Name
Interface
Interface
29/09/2012
What is a Component?
A component may be
A
An
executable component
Source File
Name
50
<<EXE>>
Executable
Name
29/09/2012
OO Principle:
Encapsulation
Component
Interface
<<DLL>>
Component
Name
Implementation Model
Component
Name
<<subsystem>>
Component Name
Component
Interface
Component
Interface
29/09/2012
Relationships
Association
Aggregation
Dependency
Generalization
Realization
generalization
Window
open()
close()
move()
display()
handleEvent()
ConsoleWindow
52
Event
association
DialogBox
29/09/2012
Control
Relationships: Association
Professor
Works for
Association
Class
53
29/09/2012
University
Department
54
29/09/2012
Student
0..*
Navigation
55
29/09/2012
Schedule
Relationships: Dependency
Class
Client
Packag
e
ClientPackage
56
Supplier
Dependency
relationship
Client
SupplierPackage
29/09/2012
Componen
t
Supplier
Dependency
relationship
Relationships: Realization
Tube
<<interface>>
Shape
Pyramid
Draw
Move
Scale
Rotate
Cube
Realization relationship
57
29/09/2012
Inheritance
Shape
origin
draw()
erase()
move()
setColor()
getColor()
Circle
draw()
erase()
Square
draw()
erase()
move()
[Martin Fowler]
58
29/09/2012
Polymorphism
Bird
FlockManager
move()
reLocate()
Goose
move()
Penguin
move()
[Martin Fowler]
59
29/09/2012
Animal
multiple
inheritance
Airplane
Helicopter
Bird
Wolf
29/09/2012
Horse
A subclass may:
Add
Redefine
29/09/2012
Superclass
(parent)
weight
licenseNumber
owner
0..*
Person
register( )
generalization
Subclass
Truck
Car
size
tonnage
getTax( )
62
29/09/2012
Trailer
Provides stability
63
Is adaptive to change
29/09/2012