codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Subjects
🧩

OOP Concepts

23 chapters

1Procedural vs Object-Oriented2Classes, Objects, & Instantiation3Constructors & Destructors4Static Members & Methods5Encapsulation & Access Modifiers6Data Abstraction7Inheritance Types (Single, Multiple)8Compile-Time Polymorphism (Overloading)9Polymorphism & Interfaces10Run-Time Polymorphism (Overriding)11Virtual Functions & V-Tables12Interfaces & Abstract Classes13Generic Programming (Templates & Generics)14Exception Handling in OOP15SOLID Design Principles16Composition over Inheritance17Coupling & Cohesion18UML Diagrams Basics19Creational Patterns (Singleton, Factory)20Structural Patterns (Adapter, Decorator)21Behavioral Patterns (Observer, Strategy)22MVC Architecture Pattern23Object Serialization & Cloning
SubjectsOOP Concepts

Procedural vs Object-Oriented

Updated 2026-05-07
2 min read

Procedural vs Object-Oriented

Before Object-Oriented Programming (OOP) became the dominant paradigm, virtually all software was written in the Procedural style. Understanding why the industry abandoned procedural programming is essential to appreciating the design philosophy behind OOP.

1. Procedural Programming

In procedural programming, a program is structured as a sequence of instructions (procedures or functions) that operate on data. The data and the functions that manipulate that data are completely separate entities.

Languages like C, Pascal, and Fortran follow the procedural paradigm.

// Procedural approach in C
struct BankAccount {
    int id;
    double balance;
};

void deposit(struct BankAccount *acc, double amount) {
    acc->balance += amount;
}

void withdraw(struct BankAccount *acc, double amount) {
    acc->balance -= amount;
}

Problems with Procedural Programming at Scale

When projects grow from 1,000 lines to 1,000,000 lines, the procedural paradigm begins to collapse:

  1. No Data Protection: Any function anywhere in the program can directly modify acc->balance. A single careless bug in a utility function can silently corrupt your bank balance. There are no access controls.
  2. Tight Coupling: Functions depend directly on the internal structure of the data. If you rename balance to current_balance, you must find and update every single function in the entire codebase that touches it.
  3. Code Reuse is Difficult: If you build a PremiumBankAccount that works like a regular account but earns interest, you must copy-paste all the functions and modify them. There is no formal mechanism for extending existing code.

2. Object-Oriented Programming

OOP was designed from the ground up to solve these problems. Instead of separating data from functions, OOP bundles them together into a single, self-contained unit called an Object.

An object contains:

  • Attributes (Data): The state of the object (e.g., balance, accountHolder).
  • Methods (Functions): The behaviors that operate on that state (e.g., deposit(), withdraw()).
// Object-Oriented approach in Java
class BankAccount {
    private double balance; // Data is HIDDEN

    public void deposit(double amount) {
        this.balance += amount;
    }

    public double getBalance() {
        return this.balance;
    }
}

The Four Pillars of OOP

The entire OOP paradigm rests on four fundamental principles:

  1. Encapsulation: Bundling data and methods together, and hiding the internal state from the outside world.
  2. Abstraction: Exposing only the essential features while hiding the complex implementation details.
  3. Inheritance: Creating new classes from existing ones, promoting code reuse.
  4. Polymorphism: Allowing objects of different types to be treated through a single, unified interface.

Each of these pillars will be explored in dedicated chapters throughout this module.

3. When to Use Which?

Procedural programming is not dead. It remains excellent for:

  • Small scripts and automation tasks.
  • Systems programming where raw performance and memory control are critical (Linux Kernel is written in C).
  • Mathematical and scientific computing.

OOP is preferred for:

  • Large-scale enterprise applications (Banking, E-commerce).
  • GUI applications and game development.
  • Any project where multiple developers collaborate on a massive, evolving codebase.


NextClasses, Objects, & Instantiation

Recommended Gear

Classes, Objects, & Instantiation