Object-Oriented

Procedure Oriented Programming

Let’s have a look at procedure-oriented and object-oriented programming.

Traditional Programming languages like COBOL, FORTRAN, BASIC, C, etc. are commonly known as Procedure Oriented Programming (POP) languages. This POP approach lets developers use their logic by applying a number of functions to enable program productivity.

In simple language, POP can be understood as: Suppose you’re asked to make a pizza, pizza sauce, and French fries for a meal.

If you follow the POP approach, you’ll first make the pizza and keep it aside. Then you’ll again make pizza sauce for the second time. After making French fries, you’ll assemble them together at the dinner table.

Similarly, in the POP system, many instructions are written to carry out a task. These instructions are grouped together to form functions. These individual functions are integrated together to form the main program.

All the important data are applied globally to all the functions and the prime focus is on the functions rather than the data items.

The data items are globally accessible throughout the program and to make any changes in any function, you’ll have to change the value of the associated data individually.

Object-Oriented Programming

In the above example, you should have observed that we had to make pizza sauce twice, first for the pizza and the second time for the individual pizza sauce.

The process wasn’t convenient because we had to do the same work twice. The optimal solution was making the pizza sauce once in greater quantity, using it once for the pizza and keeping the rest aside for separate serving This approach is called Object Oriented approach.

Object-Oriented Programming is a modular programming approach which stresses on the data items rather than the functions.

In Object-Oriented Programming, the entire program is decomposed into the number of entities called objects. These objects are maintained so that their content cannot be changed or modified by execution of other functions.

Using OOPs enables, both, increase in programmer’s productivity as well as outperform the POP based languages.

Features of Object Oriented Programming:

  • Lays stress on the data items rather than functions.
  • Makes the problem-solving process simpler by dividing the problem into a number of smaller modules called objects.
  • Data can be modified wherever required without making changes in the entire program.

A simpler way of understanding object-oriented programming is:
Suppose you have bought a packet of French Fries for you and your friend. While you want it as it was: classic salty, your friend likes it spicy.

So the best solution would be: dividing the French fries and serving it to your friend with ketchup and spices while you take it as it was.

Here you didn’t have to mix the spices into the entire packet and both you and your friend were relishing the French Fries without any sacrifice for each other!

This is the concept of Object Oriented Programming. More stress was laid to on the personal taste rather than on the French Fries Composition.

Object-Oriented