In this article, I will demonstrate you what is Procedural Programming and Object Oriented Programming. We will also discuss the differences between both of them.
It is a step by step programming approach to perform some logic. It is a set of instruction which tell the OS to perform the logic. Procedural programming is based on routines or subroutines. It contains the steps or we can say series of logic [functions] to be carried out. It is also known as top-down language. Also, it is known as Linear Programming.
In 1960s or 1970s we basically used this type of programming like COBOL and FORTRAN. So, most of the early programming language uses this approach. In this you need to provide the step by step instructions to do something.
Object Oriented Programming
OOPs are based on object, means everything is talked about in terms of object. An object is a component of a program that performs actions and interacts with other elements of the program. Object oriented programming uses reusability of code. We can take an example of object like employee. Employee has some properties like name, salary, address etc. An Employee can have different objects. Object Oriented Programming uses an object to design applications and programs.
The following are the features that will show some differences between Procedural Programming and Object Oriented Programming:
Programming Style: Procedural programming is linear programming but OOPs is not.
Fundamental Unit: Object is the fundamental unit of OOPs, but function or method is the fundamental unit of procedural programming.
Code Organization: In OOPs, we do the encapsulation of code in the form of object, but in procedural programming code is organized into small procedures.
Reusability: Reusability is the main feature of OOPs. OOPs reuse the code higher than procedural programming.
Abstraction: Hide the private data to outer logic main concern in programming logic. So, Abstraction of OOPs is higher than procedural programming.
Inheritance: In OOPs, we can inherit the existing functionality from parent, but Procedural programming does not support inheritance.
Encapsulation & Polymorphism: Encapsulation and polymorphism is also not supported by Procedural programming.
Thanks for reading this article. Hope you enjoyed it.