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:
“The real trouble about women is that they must always go on trying to adapt themselves to mens theories of women, as they always have done. When a woman is thoroughly herself, she is being what her type of man wants her to be. When a woman is hysterical its because she doesnt quite know what to be, which pattern to follow, which mans picture of woman to live up to.”
—D.H. (David Herbert)