SOLID – Interface Segregation Principle

Definition :

Clients should not be forced to depend upon interfaces that they do not use. Or as Uncle Bob says: Make fine grained interfaces that are client specific.


The idea in this picture that we have a very small dependency which is the USB cable in the upper left but instead of being able to plug that into a USB port in a computer or something, we are forced to use that device here in the right which contains buttons , switches and lights and a lot of things that we don’t need.

When we have non-cohesive interfaces, the ISP guides us to create multiple, smaller, cohesive interfaces. The original class implements each such interface. Client code can then refer to the class using the smaller interface without knowing that other members exist.


We have a fat Interface called IBird that contains these four methods or behaviors ( Walk , Eat , Sleep, Fly )

3-6-2013 2-19-02 PM

Continue reading