/ˌoʊˌoʊˈpiː/

noun … “Organizing code around objects and their interactions.”

OOP, short for Object-Oriented Programming, is a programming paradigm that structures software design around objects, which encapsulate data (attributes) and behavior (methods). Each object represents a real-world or conceptual entity and interacts with other objects through well-defined interfaces. OOP emphasizes modularity, code reuse, and abstraction, making complex systems easier to design, maintain, and extend.

Key principles of OOP include:

  • Encapsulation: Bundling data and methods together, controlling access to an object’s internal state.
  • Inheritance: Creating new classes based on existing ones to reuse or extend behavior.
  • Polymorphism: Allowing objects of different classes to be treated uniformly via shared interfaces or method overrides.
  • Abstraction: Hiding complex implementation details behind simple interfaces.

In practice, OOP is used in languages such as Java, Scala, and C++. A developer might define a base class Vehicle with methods like start() and stop(), then create subclasses Car and Bike that inherit and customize behavior. This allows polymorphic handling, such as processing a list of Vehicle objects without knowing each specific type in advance.

class Vehicle:
    def start(self):
        print("Starting vehicle")

class Car(Vehicle):
    def start(self):
        print("Starting car")

vehicles = [Vehicle(), Car()]
for v in vehicles:
    v.start()

This outputs:

Starting vehicle
Starting car

Conceptually, OOP is like a workshop of interchangeable machines. Each machine (object) performs its own tasks, but all adhere to standardized controls (interfaces). This modular design allows new machines to be added or replaced without disrupting the overall workflow.

See Scala, Java, Design Patterns, Functional Programming.