(ISP) Interface Segregation Principle

The Interface Segregation Principle (ISP) is a principle of object-oriented programming that states that clients should not be forced to depend on interfaces they do not use. It is one of the SOLID principles of software design.

The idea behind ISP is to ensure that each class provides a specific, well-defined set of methods and not a large, general-purpose interface. This helps to prevent the implementation of unnecessary or irrelevant methods and improves the flexibility and maintainability of the code.

For example, consider a class that represents a shape. A basic interface for this class might include methods such as "getArea" and "getPerimeter". However, not all shapes have a perimeter (e.g. a circle), so a separate interface for "Circle" could be created that only includes the "getArea" method. This way, the client code that only needs to calculate the area of a circle will not have to deal with the concept of a perimeter, which is not applicable.

By adhering to the ISP, developers can create more modular, flexible, and scalable code that is easier to maintain over time.

http://principles-wiki.net/principles:interface_segregation_principle