Interface Segregation Principle

Applying ISP results in no unnecessary code and no forced coupling to irrelevant method contracts. The Interface Segregation Principle states that no class should be forced to implement methods it does not use, and that many small focused…

1 sources - 4 claims

Applying ISP results in no unnecessary code and no forced coupling to irrelevant method contracts. The Interface Segregation Principle states that no class should be forced to implement methods it does not use, and that many small focused interfaces are preferred over one large general-purpose interface. An AdminUser class that implements a large UserActions interface but only uses about half its methods violates ISP because every change to the interface forces updates to AdminUser. The fix for the ISP violation is breaking the large interface into smaller role-specific interfaces such as ViewUserDashboard and ManageUserPermissions, so AdminUser implements only what it needs.