• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help understand bridge design pattern

 
Ranch Hand
Posts: 90
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at http://today.java.net/pub/a/today/2004/10/29/patterns.html
 
Tapio Niemela
Ranch Hand
Posts: 90
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic