hey, I'm bit confused about this design pattern. Searching the web I can find mostly examples that are unrealistic, hard-to-understand (maybe requires some gui framework knowledge) or somehow violate other OO concepts, there's good example on http://www.developer.com/design/article.php/10925_3732061_1 . I can clearly see advantages here, but still I'm bit confused about terms "abstraction" and "implementation" used in this context. And specially when to use it. More practical/realistical examples or any clarifications would be greatly appreciated
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Jan 06, 2006
thanks for your reply. So Bridge pattern is just "simply" combination of template method and strategy? Then it would make some sense, lots of examples were missing that template method part..
Tapio Niemela wrote:thanks for your reply. So Bridge pattern is just "simply" combination of template method and strategy? Then it would make some sense, lots of examples were missing that template method part..
Its more than just using the template and strategy patterns. Gamma et. al. state that the intent of the Bridge pattern is to, "Decouple an abstraction from its implementation so that the two can vary independently". The keywords here are "decouple" and "vary". The strategy pattern does the decoupling and the template pattern allows strategy subclasses to vary in a structured manner. For example, consider a large object that encapsulates a financial option on a bond. Using the Bridge pattern you could refactor out of this object the instructment being sold to allow it to encapsulates bond, stocks, etc. You could also use the Bridge pattern to refactor out the pricing model, with one strategy being a BlackScholesPriceModel class and another being a BinomialPricingModel class.
(There was a great article on the Bridge Pattern in the Journal of Object-Oriented Programming (JOOP) several years ago that used the above example)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com