Get flash to fully experience Pearltrees
We Recommend These Resources Continuing our series of articles, taking each design pattern one by one, we move onto the Adapter pattern. This pattern is used a lot in Eclipse, allowing plug-ins to be loosely coupled, yet still be integrated into the Eclipse runtime. Adapters in the Real World A real world analogy always helps with the understanding of a design pattern. The best example for the adapter pattern is based around AC power adapters.
In computer programming , the adapter pattern (often referred to as the wrapper pattern or simply a wrapper ) is a design pattern that translates one interface for a class into a compatible interface. [ 1 ] An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface. The adapter translates calls to its interface into calls to the original interface, and the amount of code necessary to do this is typically small. The adapter is also responsible for transforming data into appropriate forms. For instance, if multiple boolean values are stored as a single integer (i.e. flags) but the client requires individual boolean values, the adapter would be responsible for extracting the appropriate values from the integer value.