Procedural Programming vs Object-Oriented Programming – Which would win the battle?

Programming languages comes in a different flavors through different programming paradigms which provide a particular style to write the code. The style could include syntax, features, indenting, etc. Two of the most used programming paradigms are procedural and object-oriented. In the recent development of programming languages, the object-oriented style pretty much took over the old procedural style that was dominating in the early programming days.

In this tutorial, I am going to show you the difference between these two paradigms, and the pros / cons of these styles. Let’s get started!

Procedural Programming

Procedural programming is the part of imperative programming. In imperative programming, we tell the computer “how to do” rather than “what to do”. In procedural programming, we use statements to change the state of the program. Statements include the lines of code which are instructions telling the machine “how” something should be done. As we would need to write hundreds of code to perform the tasks, sometimes it becomes necessary to carefully select those lines of code or statements that are used excessively within a same program and then copy it somewhere and then paste on those places where they are required. Thankfully, procedural programming provides procedures, also knows as subroutines or functions, which can be used to hold the commonly repeated lines of code, and then use it whenever you require it in your programs.

What are procedures?

Procedures are routines / functions that holds several lines of code, which can be placed whenever you need to do something instead of writing the same lines of code again and again. Thus, it’s a way to organize the code to reduce duplication. Procedures can be called in other procedures, and even in themselves. In procedural programming, we create / define different procedures (i.e., printName, changeColor, etc.) and call them whenever we like to perform a required task.

Following is the example of the program in C, which is enough to show the procedural programming style:


  • Easier to learn the programming language
  • Encourages coding in a straight-forward way
  • Can be a good start for the newbie programmers


  • Hard to organize code
  • Looks outdated
  • Hard to add the support of new features
  • Lack flexibility

Object-oriented Programming

Object-oriented programming came later in the programming community. It is often contrasted with procedural programming, because here we deal with the objects that are created through a class — a sort of a blueprint which holds different methods / attributes — which then are manipulated and used with each other to change the state of the program. It emphasis objects rather than “actions” and data rather than “logic”.

What are objects?

When we say “object-oriented programming”, we mean that our programming revolve around the objects. An object is an entity that is created through the use of a class, so we need to first create a class for a particular object (i.e., apple, rectangle, car, etc.). It is sort of a variable or an identifier in other programming languages, however, the difference here is that it holds properties of a class (through which it is created) and the methods (also called “fields”; “functions” in procedural programming) of a class to manipulate the other objects or itself. Thus, through manipulation of the different objects, we change the state of the program.

Following is the example of a program written in Java, which can be considered a beginner example of OOP:

Here, we’ve created two classes: PrintNumber and Main. In Java, the creation of at least one class is necessary to do anything, therefore, we used the Main class as the start point of the program. Then, we’ve created PrintNumber class through which we’ve created an object named “num”. Then, we called a method “print” through “num” object, thus manipulating it.

Apart from simple classes to manipulate objects, OOP also provides several features to build relationship between objects, and to further facilitate the organization of code. These features include inheritance, polymorphism, templates, etc.


  • Encourages organization of code
  • Easier for other developers to build based on previous code
  • Very flexible to create modules


  • Slow initial startup; need to write boilerplate code even for small tasks.
  • Takes more lines of code for simple programs; need to create classes for everything
  • Often feels bloated in features


In this tutorial, I have highlighted the difference between procedural and object-oriented programming. I would argue that it’s not good to debate about the importance of either of these styles, as they both provide enough features and rules for building certain kinds of applications. Procedural programming proponents use this style for simplicity (because they love to simplify the code!) and the fact that they don’t like bloated (or extra) features that comes with object-oriented programming, so they resort to programming in the old ways. Object-oriented programming proponents use this style for the better code management (in case they want other people to work on their projects!) and their expectation of the growth of their applications force them to think in a long-run.
If you have any question that you think I’ve missed (unfortunately) in the article, then you ask in the comment section below!

Leave a Reply

Your email address will not be published. Required fields are marked *