DEV Community

Gamelia
Gamelia

Posted on

Have you ever asked yourself how we would explain or simplify Object-Oriented Programming (OOP)?

Object-Oriented Programming is a way to write programs by dividing them into smaller parts called "objects." Each object is like a Lego piece, with its own specific function, and can be connected to other pieces to build something larger.

💡 Let me simplify it for you: Imagine you have a car 🚙 with a color, engine, and body. When we want to start the car, we press the gas pedal and definitely hit the brakes if we want to slow down or stop.

I’ve left the explanation in the image below 👇
Why do we use OOP?

Organization:
It gathers all the information and functions related to the car in one place (the class).

Reusability:
We can create many different cars (objects) using the same class.

Extensibility:
We can easily add new properties and methods to the class (like "open_trunk" or "close_window").
Image description

Top comments (0)