A design pattern
used to adapt one class
to another class in Object Oriented Design
. The Adapter pattern
allows classes work together that couldn't otherwise because of incompatible interface
This node is based on the Design Patterns book by the gang of four. I would recommend buying this and checking out page 139.
OK. Suppose you want to build a simple searching mechanism. This mechanism should allow you to plug in search providers that were developed elsewhere.
Your search package should have the ability to scroll through the results of other providers. For example you should be able to run a search on Google, JXTA, etc and present the results in in the same manner.
The only problem is that each search provider has a different way of displaying results.
You could write an adapter to uniform search infrastructure which adapted the providers output to the input of your new search infrastructure.
|-- GoogleSearchAdapter ----|
| --- uniform search
|---- JXTASearchAdapter ----|
JXTA -- |