SOLID Principles

Interface Segregation Principle (ISP)

The Interface Segregation Principle states that clients should not be forced to depend on interfaces they do not use. Instead of one large, general-purpose interface, multiple smaller, more specific interfaces are preferred.

Benefits:

  • Reduces the impact of changes: Changes to one method in an interface do not force all implementing classes to change.
  • Enhances code readability and maintainability: Smaller, more focused interfaces are easier to understand.
  • Promotes the design of more cohesive and focused interfaces: Each interface is tailored to the specific needs of its clients.