In a POP(Procedure Oriented Programming) emphasis is given to functions or subroutines.Functions are a set of instructions which performs a particular task. Functions are called repeatedly in a program to execute tasks performed by them.
The problem with POP approach is its handling of data. POP approach gives no importance to data.In C, a data member must be declared GLOBAL in order to make it accessible by 2 or more functions in the program.If there are 10 functions in a program, all these 10 functions can access a global data member. It is possible one function may accidentally change values of this global data member. C language is a procedure oriented language.
In OOP(Object Oriented Programming)programs are divided into objects.Functions that operate on the data of an object are ties together.Data is hidden and can not be accessed by external function.Objects may communicate with each other through function.New data and functions can be easily added whenever necessary.Follows bottom up approach. java language is a object oriented programming.
POP vs OOP
|Procedure Oriented Programming|
|Object Oriented Programming|
|1||In POP, program is divided into smaller parts called as functions.||In OOP, program is divided into parts knows as objects.|
|2||In POP, importance is not given to data but to functions as well as sequence of actions to be done.||In OOP, importance is not given to the data rather than procedures or functions because It work as a real world.|
|3||In POP, Most function uses Global data for sharing that can be accessed freely from function to function in the system.||In OOP, data can not move easily from function to function, it can be kept public or private so we can control the access of date.|
|4||In POP, Date can move freely from function to function in the system.||In OOP, objects can move and communicate with each other through member functions.|
|5||POP dose not have any access specifier.||OOP has access specifiers named public, private, protected, default.|
|6||POP follows Top Down approach.||OOP follows Bottom Up approach.|
|7||POP dose not have any proper way for hiding date so it is less secure.||OOP provides date hiding so provides more security.|
|8||In POP overloading is not possible.||In OOP overloading is possible in the form of function overloading and operator overloading.|
I hope you guys enjoy this content. If you interested it then visit our youtube channel named alpha programmer.
Thank you 🙂