UNIT 1 COMPARE OOP and POP
UNIT 1 COMPARE OOP and POP
Large programs lead to more bugs, and it increases the time of debugging. All these flaws lead to
a new approach, namely “object-oriented programming”. In object-oriented programming’s
primary 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. There are some other differences which can be explained with the help of a comparison
chart.
1. Comparison Chart
2. Definition
3. Key Differences
4. Advantages
5. Disadvantages
6. Conclusion
Comparison Chart
BASIS FOR
POP OOP
COMPARISON
Basis Main focus is on "how to get the task done" Main focus is on 'data security'. Hence,
i.e. on the procedure or structure of a only objects are permitted to access the
Division Large program is divided into units called Entire program is divided into objects.
functions.
Entity accessing mode No access specifier observed. Access specifier are "public", "private",
"protected".
Overloading or Neither it overload functions nor operators. It overloads functions, constructors, and
Polymorphism operators.
Data hiding & security There is no proper way of hiding the data, Data is hidden in three modes public,
security increases.
Data sharing Global data is shared among the functions Data is shared among the objects through
Friend functions or No concept of friend function. Classes or function can become a friend
"friend".
c++
BASIS FOR
POP OOP
COMPARISON
Virtual classes or No concept of virtual classes . Concept of virtual function appear during
OOP’s chief 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
interact with each other through member functions to access their data.
POP is a conventional way of programming. Procedural programming is where the primary focus
is on getting the task done in sequential order. Flowchart organizes the flow of control of the
program. If the program is extensive, 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.
POP characteristics
Disadvantages
Conclusion
The flaws of POP arises the need for OOP. OOP corrects the flaws 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.