Converts the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't do so otherwise because of incompatible interfaces.
- Use when you want to use an existing class and its interface does not match the one you need, or has an incompatible interface.
This pattern is also known as a wrapper and there are variations of it, such as "pluggable adapters," which are popular in Smalltalk and NextStep environments. The one presented here is known as an "object adapter" and consists of an adaptee, which defines the existing interface being adapted, and a target, which defines the interface the client class uses. The Adapter class inherits the target interface, and forwards the requests to the adaptee by using composition.
Structure of Adapter Pattern

Implementation of Adapter Pattern
In this sample (uSingletonF.pas) the TFormAdapter is used to adapt the TSingletonForm (adaptee) interface to that of the TObserver (target) interface, which is required in order to be able to attach to TMySubject as an observer and receive notifications of state changes. TFormAdapter forwards any received Update() requests to the specific method corresponding to that request on the TSingletonForm interface, the UpdateView() method.
TFormAdapter = class(TObserver)
private
;FAdaptee: TSingletonForm;
public
constructor Create(aForm: TSingletonForm);
procedure Update(ChangedSubject: TObservable); override;
end;
implementation
// TFormAdapter
constructor TFormAdapter.Create(aForm: TSingletonForm);
begin
inherited Create;
FAdaptee := aForm;
end;
procedure TFormAdapter.Update(ChangedSubject: TObservable);
begin
FAdaptee.UpdateView;
// adapted interface
end;
Conclusion
Patterns are a vehicle for capturing and documenting "best practices" in any field. In software engineering, design patterns allow you to improve your OO designs and architectures, improve documentation and facilitate maintenance of source code. If all members of your team understand the pattern names you are referring to then patterns allow a higher level of communication during analysis/design discussions. Using patterns allows you to leverage the expertise of others.
If you are an expert in your field, write down some patterns and have your peers review them. If you are not an expert, learn the published patterns. The more patterns you know, the better a designer and solution provider you will become and it will be reflected in improved quality of the products you build. This quality and aesthetic elegance in designs is referred to as "Quality Without A Name" (QWAN) by Christopher Alexander because it imparts incommunicable beauty and immeasurable value to a structure. (For more on QWAN, see the sources of information in the Appendix.)