The Story of Object Oriented Programming

Encapsulation, Inheritance and Polymorphism: How they came to be.


There was the local state – global state problem: functions could either access local variables or global variables. So we encapsulated set of “states” and “functions that are limited by access only to those states” into “classes” – blueprints for making objects.


We had encapsulation. But for code reuse, we needed a way to modify classes by extension but not by code modification. So we invented inheritance. Later for solving diamond problem that arose in multiple inheritance we invented interface.


Now, we have a type hierarchy. Need arose for method call modification without code modification. So we invented polymorphism – a generic way to handle methods belonging to a common type hierarchy.

Design Patterns
When we applied encapsulation, inheritance and polymorphism to the development of flexible, reusable and maintainable software, common problems arose and solutions were found. Software Developers encapsulated these solutions into different “Design Patterns” – patterns for experience reuse.    

Other ways to view OOP

  • Message Passing – Objects containing states are sent messages (methods with arguments)
  • Abstract Data Type – Theoretical Model
  • Data Structures – Data (States), Operations on Data (Methods)