Page 1
Wink Notes
B.Tech CSE — 2nd Semester
Object Oriented Programming with C++
— Unit - 1 —
1. Evolution of Programming Paradigms
Before we can appreciate the object-oriented model, we must understand the historical progression of programming paradigms and the exact limitations that forced the industry to evolve.
Unstructured Programming
Early programming languages relied heavily on `GOTO` statements to jump between different parts of a program. This created 'spaghetti code'—a tangled mess of logic that was nearly impossible to debug, maintain, or extend. As programs grew past a few thousand lines, unstructured programming became a massive liability.
Procedural Oriented Programming (POP)
To solve the spaghetti code problem, POP (used by languages like C, Pascal, and Fortran) introduced functions (or procedures). The program was broken down into a series of functional calls.
- Focus on Actions: The primary concern was what the program is doing (the algorithms) rather than the data it is operating on.
- Top-Down Design: A main function controls the flow, calling smaller sub-functions, breaking the problem down.
- Global Data Vulnerability: Functions needed to share data, so data was often declared globally. Any function could accidentally modify the global data, leading to catastrophic side effects.
The Crisis of POP
As enterprise applications grew into hundreds of thousands of lines of code, POP failed. The separation of data and functions meant that if the data structure changed, every single function that touched that data had to be manually rewritten. It was fragile, non-scalable, and did not reflect how humans perceive the real world.