Loading...

SOLID Principles

SOLID Principles Refresher

Definition : The SOLID principles are a set of five design principles in object-oriented programming that help developers create more maintainable, understandable, and flexible software. These principles were introduced by Robert C. Martin, also known as Uncle Bob.

SOLID Stands For :

S - Single Responsibility Principle (SRP)
O - Open/Closed Principle (OCP)
L - Liskov Substitution Principle (LSP)
I - Interface Segregation Principle (ISP)
D - Dependency Inversion Principle (DIP)

1. Single Responsibility Principle (SRP)

Definition : The Single Responsibility Principle states that a class should have only one reason to change, meaning it should have only one responsibility.

2. Open/Closed Principle (OCP)

Definition : The Open/Closed Principle states that software entities should be open for extension but closed for modification.

3. Liskov Substitution Principle (LSP)

Definition : The Liskov Substitution Principle states that objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program.

4. Interface Segregation Principle (ISP)

Definition : The Interface Segregation Principle states that no client should be forced to depend on methods it does not use. Instead of one large interface, many smaller and more specific interfaces are preferred.

5. Dependency Inversion Principle (DIP)

Definition : The Dependency Inversion Principle states that high-level modules should not depend on low-level modules. Both should depend on abstractions.