[請教] bridge versus strategy pattern

作者: howardwang (Howard)   2011-04-16 14:16:20
最近看到design pattern中的bridge pattern,
看了UML之後,覺得跟strategy很像,
看了example code,還是認為二者很像。
(實作都交給implementor決定,
然後根據傳入的implementor執行其方法)
查了wiki之後,剛好有一節是想說兩者的差別,
其中提到
1. bridge的coupling比strategy低
2. bridge for structure; strategy for behavior
可是就我看網路上查到的code來說,
我感覺不到上述的第一點(我認為兩者一樣)
至於第2點,則是不了解意思.
我知道bridge有個重點在於
abstraction和implementation可以分別獨立開發與延伸,
而不會互相影響(所以wiki上說coupling比strategy低)
可是這一點就strategy也是一樣(context/strategy)
總覺得打結了...
有人能夠幫忙解惑嗎?
謝謝!

Links booklink

Contact Us: admin [ a t ] ucptt.com