














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!















►
The procedural-oriented languages focus on
procedures, with function as the basic unit.
You need to first figure out all the functions
and then think about how to represent data.
►
The object-oriented languages focus on
components that the user perceives, with
objects as the basic unit. You figure out all
the objects by putting all the data and
operations that describe the user's
interaction with the data.
►
Reusable software
Reusable software : you don't need to
: you don't need to
keep re-inventing the wheels and re-
keep re-inventing the wheels and re-
write the same functions for different
write the same functions for different
situations. The fastest and safest way
situations. The fastest and safest way
of developing a new application is to
of developing a new application is to
reuse existing codes - fully tested and
reuse existing codes - fully tested and
proven codes.
proven codes.
►
Information is stored within the object
Information is stored within the object
►
It is hidden from the outside world
It is hidden from the outside world
►
It can only be manipulated by the
It can only be manipulated by the
object itself
object itself
►
A phone stores several phone numbers
A phone stores several phone numbers
►
We can’t read the numbers directly
We can’t read the numbers directly
from the SIM card
from the SIM card
►
Rather phone-set reads this
Rather phone-set reads this
information for us
information for us
►
Simplifies the model by hiding
Simplifies the model by hiding
implementation details
implementation details
►
It is a barrier against change
It is a barrier against change
propagation
propagation
►
Ali stores his personal information and
Ali stores his personal information and
knows how to translate it to the
knows how to translate it to the
desired language
desired language
►
We don’t know
We don’t know
How the data is stored
How the data is stored
How Ali translates this information
How Ali translates this information
►
A Phone stores phone numbers in digital
A Phone stores phone numbers in digital
format and knows how to convert it into
format and knows how to convert it into
human-readable characters
human-readable characters
►
We don’t know
We don’t know
How the data is stored
How the data is stored
How it is converted to human-readable
How it is converted to human-readable
characters
characters
►
An object encapsulates data and
An object encapsulates data and
behaviour
behaviour
►
So how objects interact with each other?
So how objects interact with each other?
►
Each object provides an interface
Each object provides an interface
(operations)
(operations)
►
Other objects communicate through this
Other objects communicate through this
interface
interface
►
Steer Wheels
Steer Wheels
►
Accelerate
Accelerate
►
Change Gear
Change Gear
►
Apply Brakes
Apply Brakes
►
Turn Lights On/Off
Turn Lights On/Off
►
Provides services offered by the object
Provides services offered by the object
interface
interface
►
This includes
This includes
Data structures to hold object state
Data structures to hold object state
Functionality that provides required
Functionality that provides required
services
services
►
Data Structure
Data Structure
Mechanical structure of gear box
Mechanical structure of gear box
►
Functionality
Functionality
Mechanism to change gear
Mechanism to change gear
►
Means change in implementation does
Means change in implementation does
not effect object interface
not effect object interface
►
This is achieved via principles of
This is achieved via principles of
information hiding and encapsulation
information hiding and encapsulation
►
A driver can drive a car independent of
A driver can drive a car independent of
engine type (petrol, diesel)
engine type (petrol, diesel)
►
Because interface does not change
Because interface does not change
with the implementation
with the implementation