SOLID Principles: Interface Segregation Principle (ISP)

public interface someInterface{public int methodOne(){
// Do something
}public int methodTwo(){
// Do somthing diffrent
}}

if you want to implement this Interface

public someClass implements someInterface{public int methodOne(){
// logic to do something
}public int methodTwo(){
}
}

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.

public interface someInterface{public int methodOne(){
// Do something
}}public interface someDiffrentInterface{public int methodTwo(){
// Do somthing diffrent
}}

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