Game Development Reference
In-Depth Information
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
Name
Description
Target
The domain-specific interface that the client will use.
Adapter
An object that adapts the adaptee interface to the target interface.
Adaptee
An interface that needs adaptation to the target interface.
Client
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.
Search Nedrilad ::




Custom Search