SOLID Design Principles
Question
Explain SOLID.
Short interview answer
SOLID is a set of five object-oriented design principles: single responsibility, open/closed, Liskov substitution, interface segregation, and dependency inversion. Together they help keep dependencies and responsibilities small enough to change and test independently.
Detailed answer
SOLID is not a framework or a required class hierarchy. It is a way to evaluate whether a design makes change unnecessarily risky. For example, an order service that both calculates prices and sends email has two independent reasons to change; separating notification behind an interface gives it one focused responsibility. A caller that needs only IOrderReader should not be forced to depend on write operations, and application code should depend on an abstraction such as INotificationSender rather than directly constructing a concrete email client. The concrete email client can then be supplied by dependency injection. The result is not “more interfaces everywhere”; it is a design where meaningful responsibilities and dependencies are explicit.
Glossary
- SOLID: Single responsibility, open/closed, Liskov substitution, interface segregation, and dependency inversion.