Design/OOD

SOLID principles

The SOLID principles of Object Oriented Design include these five principles:

SRP – Single Responsibility Principle

OCP – Open/Closed Principle

LSP – Liskov Substitution Principle

ISP – Interface Segregation Principle

DIP – Dependency Inversion Principle

Object-Oriented Programming (OOP)

Encapsulation is achieved when each object keeps its state private, inside a class. Other objects don’t have direct access to this state. Instead, they can only call a list of public functions — called methods.

Abstraction can be thought of as a natural extension of encapsulation. Applying abstraction means that each object should only expose a high-level mechanism for using it.

Inheritance Objects are often very similar. They share common logic. But they’re not entirely the same. The child class reuses all fields and methods of the parent class (common part) and can implement its own (unique part).

polymorphism gives a way to use a class exactly like its parent so there’s no confusion with mixing types. But each child class keeps its own methods as they are.

Last updated