› Module 1: Introduction to OOP › 1.4 The Four Pillars of OOP
M O D U L E

Module 1: Introduction to OOP

Core philosophy, paradigm shift from procedural code, basic terminology, and the four pillars

1.1 What is OOP?

Object-Oriented Programming (OOP) is a fundamental programming paradigm organized around real-world data entities (objects) rather than sequential functions and procedural logic. In OOP, data and the operations that mutate that data are bound together into cohesive, self-governing units.

Core Concepts of an Object

  • State (Attributes / Data): The internal properties, attributes, and variables that hold the entity's current condition (e.g., a car's color, fuel level, current speed).
  • Behavior (Methods / Functions): The actions, operations, and business logic that an object can execute or respond to (e.g., accelerate(), brake(), turn()).
  • Identity: A unique handle or memory reference distinguishing this instance from every other instance in the system, even if all attribute values are identical.

Industry Adoption

Major enterprise and systems languages implement OOP as their foundational architecture: Java, C++, C#, Python, and JavaScript (via prototype-based OOP with class syntax). OOP enables teams to construct massive software systems that remain modular, testable, and maintainable over decades.

1.2 Procedural Programming vs OOP

Prior to OOP, software was predominantly written using Procedural Programming (e.g. C, Pascal, Fortran). In procedural design, programs are structured as a linear sequence of procedures or subroutines that act on detached global or passed data structures.

Feature Procedural Programming (POP) Object-Oriented Programming (OOP)
Core Focus Step-by-step algorithms, functions, and control flow. Data entities, encapsulation, and object interactions.
Program Structure Divided into standalone functions and subroutines. Divided into modular classes containing state and behavior.
Approach Top-down design (decompose problem into smaller functions). Bottom-up design (model entities first, then compose system).
Data Security Low: Global data moves freely between functions; easily corrupted. High: Data is encapsulated inside objects with access modifiers.
Reusability Function libraries only; difficult to extend without rewriting. Inheritance, polymorphism, and composition enable massive reuse.

1.3 Basic OOP Terminology

Mastering OOP requires precise comprehension of four foundational terms: Class, Object, Method, and Attribute.

  • Class: An abstract blueprint, prototype, or user-defined type specifying the variables and method signatures common to all instances. Occupies no runtime memory for instance data.
  • Object: A concrete runtime instance instantiated from a class template. Memory is allocated on the heap, and its attributes hold active values.
  • Method: A function defined within a class that defines behaviors and operates upon instance attributes.
  • Attribute / Field: A variable declared inside a class representing state, either per-instance or shared across all instances (static).
Figure 1.1: Class as a Blueprint Generating Concrete Objects Car (Class Blueprint) - brand: String - color: String - speed: int + start(): void + stop(): void + accelerate(): void creates / instantiates Object 1: Red Honda brand="Honda", color="Red", speed=0 (Heap Address: 0x7ffd98) Object 2: Blue Tesla brand="Tesla", color="Blue", speed=60 (Heap Address: 0x7ffdcc)

Figure 1.1: A Class defines the schema and member functions; each instantiated Object maintains its own isolated heap state.

1.4 The Four Pillars of OOP

Every object-oriented architecture rests upon four cardinal software design pillars: Encapsulation, Abstraction, Inheritance, and Polymorphism.

Figure 1.2: The Four Pillars of Object-Oriented Programming OOP Encapsulation Data hiding & bundling Private state + Public API Abstraction Hiding complexity Interfaces & Abstract classes Inheritance Code reuse & hierarchy 'IS-A' relationship Polymorphism Many forms / one interface Overloading & Overriding

Figure 1.2: The four core pillars of OOP work harmoniously to ensure safety, modularity, maintainability, and extensibility.

MODULE COMPREHENSIVE QUIZ

Module 1 Final Quiz

Test your understanding across all 4 topics of this module with interview-grade questions, tricky edge cases, and code output predictions.

Take Module 1 Final Quiz →
Yukti Mascot