The Interface Segregation Principle (ISP)
接口隔离原则
Many client specific interfaces are better than one general purpose interface
多个客户专用接口比一个通用目的接口更好。
The ISP is another one of the enabling technologies supporting component substrates
such as COM. Without it, components and classes would be much less useful and portable.
The essence of the principle is quite simple. If you have a class that has several clients,
rather than loading the class with all the methods that the clients need, create
specific interfaces for each client and multiply inherit them into the class.
ISP是另一个支持组建的技术,诸如COM。没有它,组件和类将大大减少用户和便携性。这个原则的本质相当简单。如果你有一个有很多客户端的类,不要装载这个拥有所有客户端需要的方法的类,而要为每个库户端创建指定的接口,然后在这个类中实现所有这些接口。