Interface Segregation Principle (ISP)
“Clients should not be forced to depend on methods they do not use.” In essence, large interfaces should be broken into smaller, role-specific interfaces so that implementing classes only need to know about the methods that matter to them.Purpose:
- Avoids “fat” interfaces – by splitting broad interfaces into focused ones, no class is burdened with irrelevant methods.
- Reduces coupling and side effects: Changes to one part of an interface won’t impact classes that don’t use that part.
- Makes implementations simpler and more flexible. A class can implement multiple small interfaces as needed, rather than one monolithic interface.