In SOLID, what is the distinction between SRP and ISP? (Single Responsibility Principle and Interface Segregation Principle)

SRP tells us that you should only have a single responsibility in a module. ISP tells us that you should not be forced to be confronted with more than you actually need. If you want to use a print() method from interface I, you shouldn’t have to instantiate a SwimmingPool or a DriveThru class for … Read more

Interface Segregation Principle- Program to an interface

Robert Martin has a very good explanation of Interface segregation principle (ISP), in his book “UML for Java Programmers”. Based on that, I don’t think ISP is about an interface being “focused” on one logical, coherent group of things. Because, that goes without saying; or, at least it should go without saying. Each class, interface … Read more