Design Principle, 设计原则之ISP

 

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。没有它,组件和类将大大减少用户和便携性。这个原则的本质相当简单。如果你有一个有很多客户端的类,不要装载这个拥有所有客户端需要的方法的类,而要为每个库户端创建指定的接口,然后在这个类中实现所有这些接口。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值