What is the reasoning behind the Interface Segregation Principle?

Phillip Wells picture Phillip Wells · Sep 12, 2008 · Viewed 8.2k times · Source

The Interface Segregation Principle (ISP) says that many client specific interfaces are better than one general purpose interface. Why is this important?

Answer

aku picture aku · Sep 12, 2008

ISP states that:

Clients should not be forced to depend on methods that they do not use.

ISP relates to important characteristics - cohesion and coupling.
Ideally your components must be highly tailored. It improves code robustness and maintainability.

Enforcing ISP gives you following bonuses:

  • High cohesion - better understandability, robustness
  • Low coupling - better maintainability, high resistance to changes

If you want to learn more about software design principles, get a copy of Agile Software Development, Principles, Patterns, and Practices book.