Interface Segregation Principle Video in Java OOPS

In the video explanation of Integration Segregation principle are you trying to achieve the following thing?
Assume that checkbox or textbox classes need to implement UI widget interface, then that class has to implement all the methods in interfaces under UI Widget interface but any change made to resize will not affect drag and vice versa

@SAM please help on this and can you share some further reading on improving my low-level design skills?

The principal here is about reducing the amount of recompilation and coupling. If everything a class does is on one interface, that interface can grow very large. Then you have more coupling points on that interface. Other classes that only need one or two of the methods have to get recompiled if the interface changes. So we break down into smaller interfaces so that only the interfaces we need are on those other classes.

Maybe a simple example will help clarify. Suppose we have a class called Slide that has two public methods: print and display. Then we have three interfaces, Printable (with the print method), Displayable (with the display method), and PrintDisplay (which extends both). Then we have a Slideshow class that only uses the display method and a Printer class that only uses the print method.

If our Slideshow class references the PrintDisplay interface, then any change to the print method would also affect the Slideshow class even though it never uses that method. Similarly any change to the display method would also affect the Printer class even though it never used that method. If they use the more appropriate interfaces Displayable and Printable we do not have that problem.

So Slideshow should take a Displayable and Printer should take a Printable and our Slide class implements both via the PrintDisplay interface. We can change the Slide class without recompilation of Slideshow and Printer unless we need to change the API of the corresponding interfaces. We only recompile Slideshow if the display method is changed (so on changes to the Displayable interface) and we only recompile the Printer on changes to the Printable interface.

1 Like