SOLID Principles: Interface Segregation Principle (ISP)

Image for post
Image for post
  • Developers shouldn’t be forced to depend upon interfaces that they don’t use.
  • Example:

if you want to implement this Interface

and only need to overwrite one method only why you forced to overwrite the other method and left it empty.

we solve this problem by creating two separate interfaces, every interface has only relevant methods.

Now you can implement the only interface you need.

depending on something that carries baggage that you don’t need can cause you troubles that you didn’t expect.

continuo to the rest of SOLID

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store