Interface Segregation Principle

Interface Segregation Principle

What is the Interface Segregation Principle?

Definition: Many client-specific interfaces are better than one general-purpose interface.

This principle is fairly straightforward. It is really just saying to keep your interfaces to a specific role, keep them small and concise. The video below gives an example.


This enables code concrete classes not to have to implement every single method regardless of whether they need them or not. When injecting classes into other classes using their interface, smaller interfaces can ensure only the methods that are required are initialised, thus removing code bloating.

It also makes the code much easier to read and to test. Readability and testability are almost as important as working code, as without them the code very quickly become difficult to change and easy to break.

Finally, now you know about the Interface Segregation Principle, read about the other SOLID principles of Object Orientated design here.

Leave a Comment

Your email address will not be published. Required fields are marked *