Tuesday, December 18, 2018

Interface Segregation Principle

This is part four of a five part series about SOLID class design principles by Robert C. Martin. The SOLID principles focus on achieving code that is maintainable, robust, and reusable. In this post, I will discuss the Interface Segregation Principle.
The Interface Segregation Principle (ISP): Clients should not be forced to depend upon interfaces that they do not use.

The "fat interfaces" — interfaces with additional useless methods — lead to inadvertent coupling between classes. This is the real reason why the ISP should be adhered to. Coupling is the bane of reusability. Fat interfaces also introduce unnecessary complexity, which isn't good for maintainability or robustness.

No comments:

Post a Comment