Differences between Procedural and Object Oriented Programming
This article focuses on discussing the differences between procedural and object-oriented programming.
Procedural Programming
Procedural Programming can be defined as a programming model which is derived from structured programming, based upon the concept of calling procedure. Procedures, also known as routines, subroutines or functions, simply consist of a series of computational steps to be carried out. During a program’s execution, any given procedure might be called at any point, including by other procedures or itself.
Languages used in Procedural Programming:
FORTRAN, ALGOL, COBOL,
BASIC, Pascal and C.
Object-Oriented Programming
Object-oriented programming can be defined as a programming model which is based upon the concept of objects. Objects contain data in the form of attributes and code in the form of methods. In object-oriented programming, computer programs are designed using the concept of objects that interact with the real world. Object-oriented programming languages are various but the most popular ones are class-based, meaning that objects are instances of classes, which also determine their types.
Languages used in Object-Oriented Programming:
Java, C++, C#, Python,
PHP, JavaScript, Ruby, Perl,
Objective-C, Dart, Swift, Scala.
Procedural Programming vs Object-Oriented Programming
Below are some of the differences between procedural and object-oriented programming:
Procedural Oriented Programming | Object-Oriented Programming |
---|---|
In procedural programming, the program is divided into small parts called functions. | In object-oriented programming, the program is divided into small parts called objects. |
Procedural programming follows a top-down approach. | Object-oriented programming follows a bottom-up approach. |
There is no access specifier in procedural programming. | Object-oriented programming has access specifiers like private, public, protected, etc. |
Adding new data and functions is not easy. | Adding new data and function is easy. |
Procedural programming does not have any proper way of hiding data so it is less secure. | Object-oriented programming provides data hiding so it is more secure. |
In procedural programming, overloading is not possible. | Overloading is possible in object-oriented programming. |
In procedural programming, there is no concept of data hiding and inheritance. | In object-oriented programming, the concept of data hiding and inheritance is used. |
In procedural programming, the function is more important than the data. | In object-oriented programming, data is more important than function. |
Procedural programming is based on the unreal world. | Object-oriented programming is based on the real world. |
Procedural programming is used for designing medium-sized programs. | Object-oriented programming is used for designing large and complex programs. |
Procedural programming uses the concept of procedure abstraction. | Object-oriented programming uses the concept of data abstraction. |
Code reusability absent in procedural programming, | Code reusability present in object-oriented programming. |
Examples: C, FORTRAN, Pascal, Basic, etc. | Examples: C++, Java, Python, C#, etc. |