Game Development Reference
Adapter Design Pattern
This design pattern is similar to the façade pattern, except the adapter pattern
makes two existing interfaces work together instead of defining a new one. In
order to fully understand the adapter pattern, there are some terms that should be
defined. These terms are shown in Table 9.1.
Table 9.1 Adapter Pattern Elements
The domain-specific interface that the client will use.
An object that adapts the adaptee interface to the target interface.
An interface that needs adaptation to the target interface.
The application that collaborates with the target interface.
It is possible to have the adapter class inherit from an adaptee, but doing so can
lead to design problems when adapting to the target interface. A better approach
is to store an instance of the adaptee inside the adapter class and access the
instance explicitly. The adapter pattern is depicted in Figure 9.3.
Figure 9.3 Depiction of the adapter pattern.