What
is Object Oriented Paradigm? Explain advantages of Object Oriented Programming
Ans
The
objected oriented paradigm is not just a programming style but also a design
method for building systems.
Object
oriented languages allow the programmer to specify self contained units and
specify them as objects which are made up of data and the methods or operations
which can be performed on the object.
In
object oriented programming an object contains data and provides operations (or
methods) for accessing the data. The data in an object is not visible directly
and can only be accessed through the operations. In other words the operations
are the interface to the object for the users of the object. This restriction
of access to the data is called encapsulation.
The
principle of encapsulation is essential to the object oriented paradigm. It
establishes a firewall between the user of the object and the code implementing
it, thus achieving information hiding. In particular, the user does not know how
the data of the object is represented. Since the representation of the object
is not known outside the object, it can be changed without affecting the user.
Note that the interface (operations and methods) can not be changed, only data
representation.
In
object oriented languages – such as C++, Delphi and Java - the code
within each object has variables and control structures but it is broken up
into objects with their methods.
In
the one object oriented program it is common to have many objects with the
same structure, meaning the same data and methods. When we have
objects of the same structure we refer to them as a class.
An object of a particular class is said to be an instance of
thatclass.
There
are numerous concepts which are specific to the object oriented
paradigm.
Object
oriented programming (OOP), as the name suggests, is a paradigm
where we focus real life objects while programming any solution. By
focusing real life objects we mean that over solutions revolves
around different objects, which represent respective objects in real life
situation. We not only write programs to process data, we actually write
behaviours of our programming objects, those behaviours are
called methods in objected oriented programming. The data elements on
which those objects behave, are called data-members/ fields.
In
a more in-depth view towards OOP using domain specific terminology, following
are the fundamental features we get:
Encapsulation
Inheritance
Re-usability
Information HidingThe way we make a logical boundary around behaviours (methods) and data (properties) they work on is called Encapsulation.
As in real life, objects in OOP relate to each other in one way or another, the relationship in most of the case is parent/child relationship. The child objects inherent all the functionalities (methods) and data (properties) of their parents.
Along with inheritance, some other phenomena like method overloading and overriding, provide code-reuse, which is known to be a very basic feature of object oriented programming.
When we have ways to reuse our code through one way or other, we are also in need of some security regarding our source code. To protect it from unauthorized access/ alteration. In object oriented programming, this is called Information Hiding and is achieved through "Access Modifiers" which lets us restrict access to all or some parts of our objects methods and/or data.
Encapsulation:
Inheritance:
Re-usability
Information
Hiding
·
Characteristics:
·
Discipline and idea
·
The theory of concepts, and models of human interaction with real world
phenomena
·
Data as well as operations are encapsulated in objects
·
Information hiding is used to protect internal properties of an object
·
Objects interact by means of message passing
·
A metaphor for applying an operation on an object
·
In most object-oriented languages objects are grouped in classes
·
Objects in classes are similar enough to allow programming of the
classes, as opposed to programming of the individual objects
·
Classes represent concepts whereas objects represent phenomena
·
Classes are organized in inheritance hierarchies
·
Provides for class extension or specialization
No comments:
Post a Comment