gang-of-4-patterns AT lists.siebelschool.illinois.edu
Subject: Design Patterns discussion
List archive
- From: Michael Schuerig <schuerig AT acm.org>
- To: gang-of-4-patterns AT cs.uiuc.edu
- Subject: Re: [gang-of-4-patterns] what is the diffence in adapter and bridge patterns
- Date: Tue, 20 Jul 2004 23:38:12 +0200
- List-archive: <http://mail.cs.uiuc.edu/pipermail/gang-of-4-patterns>
- List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>
On Monday 19 July 2004 06:40, Devaiah Doni wrote:
> i could not find the difference in this two patterns..
> only definition is changed..but in the implementation both looks
> same.
Adapter wraps another interface around an already existing object. The
adapter itself is concrete.
Bridge, on the other hand, allows for different realizations of an
abstraction. The main point here is *not* that you have an interface
and various implementing classes. Rather, what you have is an abstract
base class (GOF: Window) and various derived classes; the left-hand
side in the GOF class diagram for Bridge. The point, then, is that the
methods implemented in the abstract base class are realized by
delegation to another object, the Implementor (GOF: WindowImp). The
Implementor, in turn, is an interface with possibly several concrete
implementing classes.
In the GOF example, there are two derived window classes, IconWindow and
TransientWindow. These concrete classes extend the abstract base class
Window and use the provided concrete methods. How these concrete
methods are implemented is not fixed, rather it is defined by the
concrete WindowImp object, which may even be dynamically exchanged.
In effect, Bridge is a way to exchange the implementation of a base
class.
Michael
--
Michael Schuerig The Fifth Rider of the Apocalypse
mailto:michael AT schuerig.de
is a programmer.
http://www.schuerig.de/michael/
- [gang-of-4-patterns] what is the diffence in adapter and bridge patterns, Devaiah Doni, 07/18/2004
- Re: [gang-of-4-patterns] what is the diffence in adapter and bridge patterns, Michael Schuerig, 07/20/2004
- <Possible follow-up(s)>
- RE: [gang-of-4-patterns] what is the diffence in adapter and bridge patterns, Devaiah Doni, 07/19/2004
Archive powered by MHonArc 2.6.16.