What is the difference between Procedural Programming and OOP Programming ?

In Procedural Programming we use a list of instructions to tell the computer what to do and here we divide the program into small parts called functions. In PP, If you want a computer to do something, you should provide step-by-step instructions on how to do it and it follows top down apporach. It means Procedural Programming takes on applications by solving problems from the top of the code down to the bottom. The main issue in PP is that if a developer wants to edit a code he must edit every line of code that corresponds to the original change in the code.

Object-oriented Programming is a programming language that uses classes and objects to create models based on the real world environment. An object is a component of a program that knows how to perform certain actions and how to interact with other elements of the program and objects are the basic units in OOP. In OOP It is easy to edit and maintain the code. Also other developers can understand the program after development.

A method in OOP is like a procedure in PP and method is part of an object.In object-oriented programming, you organize your code by creating objects, and then you can give those objects properties and you can make them do certain things.

  • Object-oriented Programming uses methods and Procedural Programming uses procedures.
  • Object-oriented Programming uses objects where Procedural Programming uses records.
  • Object-oriented Programming uses classes where Procedural Programming uses modules
  • Object-oriented Programming uses messages where Procedural Programming uses procedure calls.
  • In PP, Most function uses Global data for sharing that can be accessed freely from function to function in the system and 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 data.
  • PP does not have any proper way for hiding data so it is less secure and OOP provides Data Hiding so provides more security.
  • PP follows Top Down approach and OOP follows Bottom Up approach.
  • In POP, Overloading is not possible and In OOP, overloading is possible in the form of Function Overloading and Operator Overloading.

I saw a simple example about PP & OOP when I searched  🙂

A simple way to compare both programming methods is to think of Object-oriented Programming as  learn to read picture book. As children see pictures of simple objects like a house or picture they know that throughout the book when they see a picture of the house it represents the word house. The children can then read through the book as words are substituted throughout the story with pictures.

In Object-oriented Programming the classes could represent the pictures in the learn to read books. A house could represent a class and anything the developer wants to have included to describe that house like the color, size, number of bathrooms etc.

In Procedural Programming the learn to read book would be words on the page without pictures to help guide the young learner through the book. If the story was changed in the beginning of the book it could disrupt or make the story later on in the book not make any sense. Although learning to read the book would make programming with Procedural Programming simple, it would make it difficult for other readers in the case of the book or programmers in the case of Procedural Programming to add to the story.

Leave a comment