This is the 5th post on SOLID Code with Emergent Design.
Interface Segregation Principle
“Separate interfaces so callers are only dependent on what they actually use”
Or, more simply…
Avoid “fat” interfaces
This principle is about breaking down our interfaces to be highly cohesive. You might have a server that provides methods to a number of different clients as such:
This can be solved by creating client-specific interfaces that are limited to only those functions required by the client (see: adapter pattern). In this way, even when you have classes that are perhaps more complex or less cohesive then you’d like, you can at least isolate this complexity: