This is a discussion on Re: Hi folks, adapter vs bridge? within the Software Patterns forums, part of the Testing category; http://www.netobjectives.com/downloa...ndStrategy.pdf This compares bridge and strategy which may help a bit. -- William Stacey "...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Re: Hi folks, adapter vs bridge?
http://www.netobjectives.com/downloa...ndStrategy.pdf This
compares bridge and strategy which may help a bit. -- William Stacey "music" <theronk@charter.net> wrote in message news:vdnv7eiit5lu6c@corp.supernews.com... > Hi folks: > > I'm struggling to find the distinct difference beween the adapter pattern > and the bridge pattern. > > They seem to be somewhat identical. Is it purely that the bridge > interfaces to a "remote" entity? > > I'm not even sure that's the case because a "remote" entity can also > constitute another object that > one sends messages to. In the "Applied Java Patterns" book, they mention > that the Interface and > Implementation between the Java AWT and the Peer classes use the bridge > pattern. That tells me > "communication between disparate systems". In our job, we have written a > bunch of data adapters > that sit in between our Java clients and our middle tier delegates and allow > us to "convert one > interface to another between objects contained within the same host". To > me, I don't see the difference > between that and a bridge... > > My impression is that the adapter pattern allows you to have an adapter that > sits between ObjectA and > ObjectB where ObjectA and ObjectB use an adapter to convert the messages > to/from ObjectA and ObjectB > such that ObjectA can communicate to ObjectB and vice/versa without each of > them having to be completly > aware of their "true" interfaces. Only the adapter need to be concerned. > > My impression of the Bridge Pattern allows 2 objects to communicate back and > forth using a Bridge to convert > the messages and replies between each other. And you can simply swap in > either end with a concrete implementation > and the Bridge does not need to change nor does each end need to be aware > that a "swap" has occurred. > > Both the Adapter and Bridge seem quite similar in this regard. > > I'd appreciate if someone could make this distinction crystal clear to me. > > thanks, Theron > > |