← Back to Roadmap

What is Object-Oriented Programming?

Easy

In plain terms

Object-Oriented Programming (OOP) is a way of designing software around "objects"—bundles of data and the functions that operate on that data. Instead of having separate variables and functions everywhere, you group related data and behavior into a single unit.

OOP helps you model real-world things: a "Car" object might have data (color, speed) and methods (start, stop, accelerate). It also supports reuse through inheritance and polymorphism. Most modern languages (Java, C#, Python, JavaScript) support OOP. The ideas—encapsulation, abstraction, inheritance, polymorphism—apply across languages.

What you need to know

  • Object: data (properties) + behavior (methods)
  • Models real-world entities
  • Encapsulation, inheritance, polymorphism

Example

Code is language-agnostic in spirit; adapt the idea to your language:

// Object: data + behavior
const car = {
  color: "red",
  speed: 0,
  accelerate() {
    this.speed += 10;
  },
  brake() {
    this.speed = Math.max(0, this.speed - 10);
  }
};
car.accelerate();
console.log(car.speed);  // 10

Why this matters

OOP is a standard interview topic. You may be asked to design a system with classes, explain the four pillars, or compare OOP with other paradigms (e.g. functional).

How it connects

OOP builds on basics: variables become properties, functions become methods. The next topics (classes, encapsulation, abstraction, inheritance, polymorphism) are the pillars interviewers expect you to name and explain.

Interview focus

Be ready to explain these; they come up often.

  • Name the four pillars: Encapsulation, Abstraction, Inheritance, Polymorphism.
  • Give a real-world example (e.g. Vehicle → Car, Bike) and map it to OOP terms.
  • When to use OOP vs procedural/functional: "When you have clear entities with state and behavior."

Learn more

Dive deeper with these resources: