Difference between revisions of "Adapter"
(→Adapter Design Pattern) |
(→Adapter Design Pattern) |
||
Line 4: | Line 4: | ||
Adapter, a Structural Pattern and also referred to as a '''wrapper''', is most commonly used when you want to reuse a class to work with a target class but are constrained by incompatible interfaces. The idea is to convert the interface of a reusable class into an interface that ''your'' classes expect. | Adapter, a Structural Pattern and also referred to as a '''wrapper''', is most commonly used when you want to reuse a class to work with a target class but are constrained by incompatible interfaces. The idea is to convert the interface of a reusable class into an interface that ''your'' classes expect. | ||
− | A good analogy for the Adapter pattern would be the adapter's commonly used to convert the voltage of Canadian/U.S made appliances to be used in different countries. In this case, the appliance ('''Target''') is using the adapter ('''Adapter''') to reuse the socket ('''Adaptee'''). | + | A good analogy for the Adapter pattern would be the adapter's commonly used to convert the voltage of Canadian/U.S made appliances to be used in different countries. In this case, the appliance ('''Target''') is using the adapter ('''Adapter''') to reuse the socket ('''Adaptee''') already in place. |
== Adapter UML Diagrams == | == Adapter UML Diagrams == |
Revision as of 18:56, 25 February 2007
Adapter Design Pattern
Adapter, a Structural Pattern and also referred to as a wrapper, is most commonly used when you want to reuse a class to work with a target class but are constrained by incompatible interfaces. The idea is to convert the interface of a reusable class into an interface that your classes expect.
A good analogy for the Adapter pattern would be the adapter's commonly used to convert the voltage of Canadian/U.S made appliances to be used in different countries. In this case, the appliance (Target) is using the adapter (Adapter) to reuse the socket (Adaptee) already in place.
Adapter UML Diagrams
Code Examples
References
Other
--Rueen 19:41, 17 January 2007 (EST)