Sie sind auf Seite 1von 6

Difference between OOP and POP

Procedure-oriented Programming (POP) and Object-oriented programming (OOP) both are


the programming approaches, which uses high-level language for programming.

A Program can be written in both the languages, but if the task is highly complex, OOP
operates well as compared to POP.

In POP, the ‘data security’ is at risk as data freely moves in the program, as well as, ‘code
reusability’ is not achieved which makes the programming lengthy, and hard to understand.

Large programs lead to more bugs, and it increases the time of debugging. All these flaws
(faults) lead to a new approach namely “object-oriented programming”.

In object-oriented programming’s main concern is given on ‘data security’; it binds the data
closely to the functions which operate on it. It also resolves the problem of ‘code reusability’,
as if a class is created, its multiple instances (objects) can be created which reuses the
members and member functions defined by a class.
Comparison Chart

BASIS FOR
POP OOP
COMPARISON

Basic Procedure/Structure oriented. Object oriented.

Approach Top-down. Bottom-up.

Basis Main focus is on "how to get the task Main focus is on 'data security'.
done" i.e. on the procedure or Hence, only objects are permitted
structure of a program. to access the entities of a class.

Division Large program is divided into units Entire program is divided into
called functions. objects.

Entity accessing mode No access specifier observed. Access specifier are "public",
"private", "protected".

Overloading/Polymorphism Neither has it overloaded functions It overloads functions,


nor operators. constructors, and operators.

Inheritance There is no provision of inheritance. Inheritance achieved in three


modes public private and
protected.

Data hiding & security There is no proper way of hiding the Data is hidden in three modes
data, so data is insecure public, private, and protected.
hence data security increases.

Data sharing Global data is shared among the Data is shared among the objects
functions in the program. through the member functions.

Friend functions/classes No concept of friend function. Classes or function can become a


friend of another class with the
keyword "friend".
Note: "friend" keyword is used
only in c++

Virtual classes/ function No concept of virtual classes . Concept of virtual function


appear during inheritance.

Example C, VB, FORTRAN, Pascal C++, JAVA, VB.NET, C#.NET.


Definition of Object-oriented programming (OOP)

OOP’s main concern is to hide the data from non-member functions of a class, which it treats
like “critical information”. Data is closely tied to the member functions of a class, which
operates on it. It doesn’t allow any non-member function to modify the data inside it. Objects
communicate with each other through member functions to access their data.

OOP is developed on the basic concept of “object”, “classes”, “data encapsulation or


abstraction”, “inheritance”, and “Polymorphism/overloading”. In OOP, programs can be
divided into modules by partitioning data and functions, which further can be used as
templates for creating new copies of modules, if required.
Definition of Procedure oriented programming (POP)

POP is a conventional way of programming. Procedural programming is where the


primary focus is on getting the task done in a sequential order. Flowchart organizes the flow
of control of the program. If the program is large, it is structured in some small units called
functions, which shares global data. Here the concern of data security arises, as there is an
unintentional change in the program by functions.

Key Differences Between OOP and POP


1. POP is a procedure oriented programming whereas, OOP is an object oriented
programming.
2. The main focus of POP is on “how to get the task done” it follows the flow chart to
get the task done. OOP’s main focus is on data security as only the objects of a class
are allowed to access the attributes or function of a class.
3. The functions are small units of the large programs that execute to get the main task
done. In OOP attributes and functions of the class are divided among the objects.
4. In POP, there is no specific accessing mode to access attributes or functions in the
program whereas, in OOP there are three accessing modes “public”, “private”,
“protected”, that are used as an accessing share to access attributes or functions.
5. POP does not support the concept of Overloading/polymorphism. OOP supports
Overloading/Polymorphism a means using the same function name for performing
different functions. We can overload functions, constructor, and operators in OOP.
6. There is no concept of inheritance in POP whereas, OOP supports inheritance which
allows using the attribute and functions of other class by inheriting it.
7. POP is less secure as compared to OOP because in OOP the access specifier limits the
access to attributes or functions which increase the security.
8. In POP if some data is to be shared among all the functions in the program is declared
globally outside all functions. In OOP the data member of the class can be accessed
through the member functions of the class.
9. In POP there is no concept of the friend function whereas, in OOP there is a concept
of friend function which is not the member of the class but because it is friend
member it can access the data member and member functions of the class.
10. There is no concept of virtual classes in POP whereas, in OOP the virtual functions
supports polymorphism.

Conclusion
The flaws (fault) of POP arises the need of OOP. OOP corrects the flaws (fault) of POP by
introducing the concept of “object” and “classes”. It enhances the data security, and
automatic initialization & clear-up of objects. OOP makes it possible to create multiple
instances of the object without any interference.
Differences between Procedural and Object oriented Language

Das könnte Ihnen auch gefallen