How does ISP prevent "fat interfaces"?
Why Interviewers Ask This
Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.
Answer
ISP prevents fat interfaces by encouraging role-based interface design — instead of designing an interface from the perspective of a single implementor, you design it from the perspective of each client. Each client only sees the methods it actually needs. For example, a Printable interface with print(), scan(), fax(), and copy() is fat — a simple printer only prints but must implement all methods. ISP splits this into Printable, Scannable, Faxable, and Copyable interfaces. Implementors compose only what they support. The practical benefit: adding a new method to a fat interface breaks all implementors; adding a method to a small interface only affects those that choose to implement it. ISP-driven interfaces tend to be more stable and versioned independently.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last SOLID Principles project, I used this when...' immediately makes your answer more credible and memorable.
Previous
What are the conditions for LSP compliance?
Next
What is the difference between DIP and dependency injection containers?
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 What is the difference between DIP and dependency injection containers?
- Intermediate How does SOLID relate to GRASP principles?