10ISP: THE INTERFACE SEGREGATION PRINCIPLE

Image

The Interface Segregation Principle (ISP) derives its name from the diagram shown in Figure 10.1.

Image

Figure 10.1 The Interface Segregation Principle

In the situation illustrated in Figure 10.1, there are several users who use the operations of the OPS class. Let’s assume that User1 uses only op1, User2 uses only op2, and User3 uses only op3.

Now imagine that OPS is a class written in a language like Java. Clearly, in that case, the source code of User1 will inadvertently depend on op2 and op3, even though ...

Get Clean Architecture: A Craftsman's Guide to Software Structure and Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.