Lesson 4: ISP and focused interfaces
Ever seen a class implement an interface and throw NotSupportedException in half the methods? That is the pain a fat interface creates: every client is dragged into depending on operations it does not need, and any change to the interface breaks unrelated classes. In this lesson we split a fat offic
ISP is like splitting a giant menu into a few small ones: someone who only wants coffee gets one short page, not a 200-page booklet.
- Interface Segregation Principle (ISP)
- A client should not depend on methods it does not use — split a wide interface into several small, focused role interfaces.
- fat interface
- An interface that forces implementers to provide methods irrelevant to them. The classic symptom: methods that only throw NotSupportedException.