一句话Design Pattern:Bridge

来源:互联网 发布:淘宝客服数据在哪看 编辑:程序博客网 时间:2024/06/02 01:47
定义:The bridge pattern is a design pattern used in software engineering which is meant to "decouple an abstraction from its implementation so that the two can vary independently". The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes.

一句话:让implementation的interface变成has-a,implementation的真正实现在创建时绑定。

类比:高级的strategy,不仅实现可以变化,interface也能变。
0 0
原创粉丝点击