代码改变世界

设计模式 Tips

2010-08-03 23:40  宗哥  阅读(196)  评论(0编辑  收藏  举报
 Bridge and Strategy

Often, the Strategy Pattern is confused with the Bridge Pattern. Even though, these two patterns are similar in structure, they are trying to solve two different design problems. Strategy is mainly concerned in encapsulating algorithms, whereas Bridge decouples the abstraction from the implementation, to provide different implementation for the same abstraction.

Bridge 强调Abstraction and its Implementation,Strategy强调Aalgorithm Family

Bridge and Adapter

The structure of the Adapter Pattern (object adapter) may look similar to the Bridge Pattern. However, the adapter is meant to change the interface of an existing object and is mainly intended to make unrelated classes work together.

Adapter突出existing,reuse。

;