๐ฐ๏ธ Object Oriented Programming โ History and Evolution
Object-Oriented Programming (OOP) emerged to tackle the increasing complexity of software systems. It provides a structured way to organize code around objects, which combine data and behavior.
๐ Timeline of OOP Evolution
1960s โ Simula (Norway)
Introduced classes and objects โ the foundation of OOP.1970s โ Smalltalk
Fully object-oriented; introduced message passing.1980s โ C++
Extended C with classes, encapsulation, and inheritance.1995 โ Java
Platform-independent language with garbage collection and built-in support for OOP.
๐ค Why OOP?
Traditional procedural programming (like C) worked fine for small programs but failed to scale well:
- Code was hard to maintain and extend
- Data and logic were separated
- Reuse was limited and error-prone
OOP addressed these issues using four main principles: Encapsulation, Inheritance, Polymorphism, and Abstraction.
๐งช Simple Java Example
class Car {
String color = "Red";
void displayColor() {
System.out.println("Car color is: " + color);
}
public static void main(String[] args) {
Car myCar = new Car();
myCar.displayColor();
}
}