aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes help understand bridge design pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "help understand bridge design pattern " Watch "help understand bridge design pattern " New topic
Author

help understand bridge design pattern

Tapio Niemela
Ranch Hand

Joined: Jan 06, 2006
Posts: 77
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

thanks in advance
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Take a look at http://today.java.net/pub/a/today/2004/10/29/patterns.html


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
Tapio Niemela
Ranch Hand

Joined: Jan 06, 2006
Posts: 77
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..
Ran Pleasant
Ranch Hand

Joined: Jan 16, 2003
Posts: 75
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..

Tapio

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)


Ran
 
 
subject: help understand bridge design pattern
 
Similar Threads
Abstract Factory and Factory Pattern applied to Sun's Blueprint on DAO
Command vs Strategy Pattern?
How do I keep our patterns alive and clean
Regarding Design Patterns
About Getters & Setters