Interface Segregation Principle (ISP)
This principle advises software designers to avoid depending on things that they don’t use.
We should not force clients to depend upon methods that they do not use.
AKA: Interface Pollution or Fat Interface (2002 Martin 235)
When a class is large, rarely do all of its clients use all of its methods. Often we can see different groupings of methods that particular clients use. If we create an interface for each of these groupings and have the large class implement those interfaces, each client can see the big class through that particular interface. This helps us hide information and also decreases dependency on the system. (Feathers 263)
Since we typically use interfaces for unrelated classes, they tend to have a leaner set of members. Remember, each member of an interface must be implemented in derived classes, but we should not force clients to implement methods they do not use. This “interface pollution” or “fat interface” tends to violate the Interface Segregation Principle (ISP).
Example: Poor Design
Example: Better Design
Relationship Between ISP and SRP
A fat interface with low cohesion forces any implementer to include many different behaviors, which breaks the Single Responsibility Principle. The main exception is a pure Facade: it simply delegates each group of behavior to a dedicated helper, so each class still has only one reason to change.
See Also:
Cohesion (Fat interfaces often lack cohesion)
Evolving Configuration Interfaces From Boolean Flags to Expressive Design ( mentions ISP)