What does SOLID stand for?medium

Type
conceptual
Topic
solid
Frequency
very common
Tags
solid
Answer

Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion - five principles for writing maintainable object-oriented code.

Explanation

SRP: a class has one reason to change. OCP: open for extension, closed for modification. LSP: subtypes must be substitutable for their base types. ISP: prefer many small interfaces over one large one. DIP: depend on abstractions, not concretions. Violations of these principles typically manifest as tight coupling, hard-to-test code, and classes that break when unrelated features change.

Follow-upGive an example of violating the Single Responsibility Principle and how you would fix it.