Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /home/anubhav1994/public_html/mpstudy.com/wp-includes/plugin.php on line 601

Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /home/anubhav1994/public_html/mpstudy.com/wp-includes/plugin.php on line 601
Difference between Procedure Oriented and Object Oriented Pro
Warning: Cannot assign an empty string to a string offset in /home/anubhav1994/public_html/mpstudy.com/wp-includes/class.wp-scripts.php on line 447

Difference between Procedure Oriented and Object Oriented Programming

Difference between Procedure Oriented and Object Oriented Programming

We all know there exist 2 approaches to write a program – 1) Procedure oriented programming (POP) and 2) Object oriented programming (OOP). You can write a program in either way but there are notable differences between both approaches. These 2 approaches are the result of software development evolution over many decades. Since the invention of computer, many approaches and methods have been tried to write a program. It includes methods like a) Top-Down programming b)Bottom-Up programming c) Modular programming  d) Structured programming etc. The basic purpose or the basic aim of all these methods were same – “to make programming efficient” – means to make the process of writing a complex program less harder, bug free, easily understandable, easily expandable/modifiable etc.

In simple words, difference between POP and OOP can be explained like this:- A programmer can handle the task of developing a moderately complex program fairly well enough with POP method. When the program gets even more complex or is of a highly complex type; it would be difficult to write it efficiently using POP method. The whole task of programming would get harder, will take more time, more bugs, more time for debugging etc. In such a case OOP method proves to be much more efficient than POP method. A highly complex program can be developed much efficiently using OOP method. I hope you got a general idea of the difference between both! There is no rule that one should use a particular method to develop a program. Its upto the discretion of the programmer. However in the software development industry, they all follow OOP method as it facilitates collaborative working. The main reason is code reusability. A particular piece of code developed by one programmer can be reused any number of times by any number of other programmers. This makes software development much faster and efficient.

Let’s look at both of them in brief:- 

Procedure Oriented Programming

The word “procedure” is the key element here to notice. It means “a set of procedures” which is a “set of subroutines” or a “set of functions“. We all know about “functions in C language”. ‘C’ is a procedure oriented language. In a POP method, 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. For example, a program may involve collecting data from user (reading), performing some kind of calculations on the collected data (calculation), and finally displaying the result to the user when requested (printing). All the 3 tasks of reading, calculating and printing can be written in a program with the help of 3 different functions which performs these 3 different tasks.

Difference between procedure oriented and object oriented programming

Structure of POP method

The problem with POP approach is its handling of data. POP approach gives no importance to data. By ‘data’ we mean the information collected from user, the new results obtained after calculations etc. If you are familiar with ‘C programming’, you may recollect “storage classes” in C.  In C, a data member must be declared GLOBAL inorder to make it accessible by 2 or more functions in the program. What happens when 2 or more functions work on the same data member ? 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. If this data member is a key element of the program, any such accidental manipulation will affect the whole program. It will be too difficult to debug & identify which function is causing the problem if the program is really big.

Handling of data & functions in POP

Share this post