《架构整洁之道》:Chap10. ISP: THE INTERFACE SEGREGATION PRINCIPLE ISP:接口隔离原则
The Interface Segregation Principle (ISP) derives its name from the diagram shown in Figure 10.1. “接口隔离原则(ISP)”这个名字来自图 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. 在图 10.1 所描绘的应用中,有多个用户需要操作 OPS 类。现在,我们假设这里的 User1 只需要使用 op1,User2 只需要使用 op2,User3 只需要使用 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 it doesn’t call them. This dependence means that a change to the source code of op2 in OPS will force User1 to be recompiled and redeployed, even though nothing that it cared about has actually changed. ...