SOLID Flashcards
SOLID
S - Single Responsibility Principle (SRP)
Keep each class focused on one responsibility.
SOLID
O - Open/Closed Principle (OCP)
Extend classes with new functionality without changing existing code.
SOLID
L - Liskov Substitution Prinicple
Subclasses should be replaceable for their parent class without issues.
SOLID
I - Interface Segregation Principle
The Interface Segregation Principle (ISP) states that no client should be forced to depend on methods it does not use. In other words, it’s better to have many small, specific interfaces than one large, general-purpose interface. This way, clients only implement the methods they actually need, keeping the system more modular and easy to maintain.
SOLID
D - Dependency Inversion Principle
The Dependency Inversion Principle (DIP) states that high-level modules should not depend on low-level modules. Both should depend on abstractions (like interfaces or abstract classes). Additionally, abstractions should not depend on details. The details (concrete implementations) should depend on abstractions.