Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

[Design Patterns] Adapter and Bridge

Thread view: 
v4vijayakumar - 21 Apr 2006 08:04 GMT
Adapter makes things work after they're designed; Bridge makes them
work before they are.

what the above statement from [GOF, p219] means?
sreekanth.ramakrishnan@gmail.com - 21 Apr 2006 09:38 GMT
Adapter makes things work after they're designed; Bridge makes them
work before they are.

what the above statement from [GOF, p219] means?

Hi,

The answer to your question is simple.

Bridge pattern Decouples Abstraction and Implementation. You will be
actually working with the abstraction in your client system. So it will
work as the framework was designed for since abstraction never changes.

http://en.wikipedia.org/wiki/Bridge_pattern

But in an adapter pattern, you introduce a wrapper over your designed
system so that multiple clients can interface. In one style of
implementation you ask clients to adhere to a specific abstraction. In
another you just provide a wrapper for the various abstractions which a
client might need.

http://en.wikipedia.org/wiki/Adapter_pattern

Hope these links and my answer helps u
Thomas Weidenfeller - 21 Apr 2006 10:32 GMT
> Adapter makes things work after they're designed; Bridge makes them
> work before they are.
>
> what the above statement from [GOF, p219] means?

Actually, this is described in the paragraph before what you have
quoted. To express it in other words:

If you have two existing things which don't fit well together, you use
an Adapter to glue them together.

If you design something from scratch and you know upfront that you have
one or more implementations behind a common abstraction (an interface),
you right from the start design a Bridge to link abstraction and
implementation.

An Adapter is there to cure a symptom (things not fitting together). A
Bridge is a design choice when you want to decouple an abstraction and
an implementation to a certain degree.

The code of an Adapter and a Bridge can look the same. It is the
intention why it was introduced which makes the difference.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.