01 Object Oriented Concepts
01 Object Oriented Concepts
Chapter 1
Objectives
On completion of this chapter you will be
able to
Understand Object Oriented Approach.
Identify need for OO approach.
Describe what is an Object Model.
Distinguish between procedural analysis and
Object Oriented Analysis.
Need of Object Oriented
Approach
Impedance mismatch between user of a
system and its developer
Software is Inherently Complex
Changing Requirements during development.
Difficulty of managing software development
process. It’s a team effort.
Easy User Interface.
Clients want systems to be adaptable and
Extensible.
Object Oriented Approach
Object oriented approach helps to handle
the complexity of software development
and aids in generation of adaptable and
Extensible Systems.
Structured Method Functions
And Data
Procedures
Object Object
Object Oriented Approach
An object oriented software is composed of
discrete objects interacting with each other
to give rise to the overall (complex)
behavior of the system.
What is an Object?
An object is an entity that has well
defined structure and behavior.
Characteristics of an object
State
Behavior
Identity
Responsibility
State of an Object
The state of an object encompasses the
current values of all its attributes.
An attribute can be static or dynamic.
State of an Object
Car Attributes
Color
Average
Make Static
Power
Fuel type
Values of all attributes
Speed at any moment defines
Fuel level the state of the car
Tyre pressure Dynamic
Gear
Behavior of an Object
Behavior is how an object acts or reacts, in
terms of its state changes and operations
performed upon it.
Behavior of an Object
Window Operations
Open
Close
Maximize
Minimize
Totality of operations we can
Resize
perform upon a window and
Move
consequent changes in attributes
Write
defines behavior of a window
Identity of an Object
Identity is that property of an object which
distinguishes it from all other objects.
Identity of an Object
Bank Account
Balance
Interest Rate
Account Number Identity
Customer
Vehicle
Kinetic Scooter
Object Model : Inheritance
‘Is a’ kind of Hierarchy
Generalization and specialization are two
points of view that are based on the class
hierarchies. They express the direction in
which the class hierarchy is extended.
Object Model :
Containment
‘has-a’ kind of
Relationship
Car
Engine
dsa
Insurance
gffg
Registration
Wheels
Object Model : Polymorphism
The ability of different objects to respond to
the same message in different ways is
called polymorphism.
Polymorphism helps us to :
Design extensible software as we can add
new objects to the design without rewriting
existing procedures.
Polymorphism
Move ()
Move ()
Move ()
Move ()
Object Model: Minor Pillars
3 Minor Pillars
Strong Type Casting : prevents mixing of
abstraction. E.g - Bank Slip.
Persistence : saves state of a object across
time and space. E.g - Local object and object
that outlive the program.
Concurrency : many objects responding
simultaneously. E.g - typing into a file &
printing some previous file at the same time.