Software Engineering: Interface Segregation Principle Explained
ISP prevents clients from depending on unused methods. Interfaces are segregated into smaller, single-responsibility interfaces like IPrint, IScan & IFax.
No client should be forced to depend on a method it does not use Consider example of office space where various output devices are represented using objects Before Interface Segregation Principle: IMultiFunction Interface /** * @ImultiFunction interface has methods related to all output devices present in office space * for devices like Printer, Scanner, Fax machines, etc */ public interface IMultiFunction { public void print(); public void getPrintSpoolDetails(); public void scan(); public void scanPhoto(); public void fax(); public void internetFax(); }...