Você está na página 1de 9

Object Oriented Design

Presented by
Anip Shah

What is Object Oriented Design?


A design method in which a system is modelled as a collection of
cooperating objects
Rather than structure programs as code and data, an objectoriented system integrates the two using the concept of an
"object"
An object has state (data) and behavior (code)

Object Oriented Design Concepts


Abstraction

Inheritance

Code

Object
Oriented
Design

Encapsulat
ion

Polymorphis
m

Abstraction
Abstraction is a mechanism to manage complexity
It is a method of generalizing so that underneath complex logic is
not exposed to the user
An abstraction includes the essential details relative to the
perspective of the viewer

Thus, while we see a car as a means of transportation, the


automotive engineer may see it as a large mass with a small
contact area between it and the road
Abstraction is achieved in programming using interfaces and

Encapsulation
Encapsulation is the mechanism that binds together code and the
data it manipulates, and keeps both safe from outside interference
and misuse
One way to think about encapsulation is as a protective wrapper
that prevents the code and data from being arbitrarily accessed by
other code defined outside the wrapper
Access to the code and data inside the wrapper is tightly controlled
through a well-defined interface
For example, we do not need to know the internal working of the
mobile phone in order to use it. There is an interface to use it
without knowing implementation details
Encapsulation is achieved in programming using access modifiers

Encapsulation vs. Abstraction


Encapsulation
Calculator shows the result
of the equation but hides
the implementation
(calculation of result)
involved
Abstraction
The calculator has to be
powered by a battery
source. How the battery
module works for the
calculator is not necessary
to know for the user

Inheritance
Inheritance is the process by which one object acquires the
properties of another
Without the use of hierarchies, each object would need to define all
of its characteristics explicitly
However, by use of inheritance, an object need only define those
qualities that make it unique within its class. It can inherit its
general attributes from its parent
It can be achieved in programming by extending the superclass to
form subclasses

Code

Polymorphism
Polymorphism is the characteristic of being able to assign a
different meaning or usage to something in different contexts
It allows one interface to be used for a general class of actions. The
specific action is determined by the exact nature of the situation
You use a button by applying pressure to it. What a button does,
however, depends on what it is connected to and the context in
which it is used
Polymorphism can be achieved in programming using method
overloading and method overriding

Code

Thank You

Você também pode gostar