intermediateSOLID Principles
What is the Interface Segregation Principle, and why do 'fat interfaces' violate it?
Clients shouldn't be forced to depend on methods they don't use — a class implementing an interface should need every method on it, not just some. A 'fat interface' like Worker with work() and eat() methods forces a Robot implementation to provide a meaningless eat() method; splitting it into separate Workable and Eatable interfaces lets each class implement only what actually applies to it.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response