Adapter Pattern

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. 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 your client requires a 'true'/'false', the adapter would be responsible for extracting the appropriate values from the integer value. Another example is transforming the format of dates (e.g. YYYYMMDD to MM/DD/YYYY or DD/MM/YYYY).

Famous quotes containing the word pattern:

    With only one life to live we can’t afford to live it only for itself. Somehow we must each for himself, find the way in which we can make our individual lives fit into the pattern of all the lives which surround it. We must establish our own relationships to the whole. And each must do it in his own way, using his own talents, relying on his own integrity and strength, climbing his own road to his own summit.
    Hortense Odlum (1892–?)