S.O.L.I.D. : 4. Interface Segregation Principle

The interface-segregation principle (ISP) states that no client should be forced to depend on methods it does not use. ISP splits interfaces that are very large into smaller and more specific ones so that clients will only have to know about the methods that are of interest to them. Such shrunken interfaces are also called role interfaces. ISP is intended to keep a system decoupled and thus easier to refactor, change, and redeploy. ISP is one of the five SOLID principles of object-oriented design, similar to the High Cohesion Principle of GRASP.


Actually if a class inherit one or more interface then this class must override all the methods whether all the methods are usefull or not.

So if we create a interface with lot of function then it force client to define all the fuctions in class.

For exmaple:-

In this exmaple Coder and Tester both are implementing Workable interface. So wheter a coder can test or not, it have to define the behaviour same for tester.

To avoid this problem, we should segregate this interface as :-

Next Principle >>

<< Previous Principle

Please follow and like us:

Leave a Reply