> For the complete documentation index, see [llms.txt](https://luj.gitbook.io/code/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://luj.gitbook.io/code/designood.md).

# Design/OOD

## SOLID principles

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

[SRP – Single Responsibility Principle](https://deviq.com/single-responsibility-principle)

[OCP – Open/Closed Principle](https://deviq.com/open-closed-principle)

[LSP – Liskov Substitution Principle](https://deviq.com/liskov-substitution-principle)

[ISP – Interface Segregation Principle](https://deviq.com/interface-segregation-principle)

[DIP – Dependency Inversion Principle](https://deviq.com/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.
