What are the trade-offs of strictly following SOLID?
Answer
Strict SOLID adherence has real costs. (1) Increased number of classes/interfaces — splitting responsibilities creates more files, more navigation overhead, and more cognitive load for newcomers. (2) Over-abstraction — creating interfaces for everything adds indirection that makes code harder to trace and understand (Java enterprise patterns like the infamous "AbstractSingletonProxyFactoryBean" are examples). (3) Premature optimization — designing for extension before understanding what will actually change can lead to the wrong abstractions. (4) Performance overhead — polymorphism and dependency injection add runtime indirection. The pragmatic approach: apply SOLID principles where complexity justifies it. Simple scripts and small functions don't need DIP. Apply SOLID proportionally to the likelihood and cost of change.
Previous
How do SOLID principles apply to functional programming?
Next
How does OCP work with inheritance vs composition?
More SOLID Principles Questions
View all →- Intermediate How would you refactor a class that violates SRP?
- Intermediate How does the Strategy pattern support OCP?
- Intermediate What are the conditions for LSP compliance?
- Intermediate How does ISP prevent "fat interfaces"?
- Intermediate What is the difference between DIP and dependency injection containers?