Interface Segregation Principle Common smells and Related Design Patterns
- Liskov Substitution Principle violation smell often indicates a violation of Interface Segregation Principle
- Client's code references a [[class]] but uses only a small portion of it's [[API]]
- Fat [[interface]] -> segregate it
- Fat [[interface]] which is not under your control -> [[Facade design pattern]]
- Adapter Design Pattern
TipsΒΆ
- General algorithm of "fixing" fat interfaces
- Create narrower interface
- Fat interface inherits from that narrow interface
- Client uses the narrow interface
- Don't abuse ISP by creating tons of small interfaces