Useful Variations
1a Symmetrical adapters
None of the classes that the client is interested in looks
like the target. They all need to be adapted to look like what we need them to
look like. The speedometer situation is like that since all existing cars
(which I know of) translate wheel-turn rates into ground-speed. However, at
some point, the inevitable interventions of big-brother will manifest itself in
the use of GPS for speed-measurement (and of course speed-tracking and
automatic ticketing). In this case we will not need the use of an adapter
since GPS measures actual distance traveled and not “wheel-turn-rates.”
1b Asymmetrical adapters
Some adaptees have the desired interface and so do not need adaptation.
Some adaptees however, need adaptation in order to integrate with the main
system, whether from legacy systems or systems newly acquired.
2a Distributed adapter/Wide adapter
Adapts several methods within the adaptee into several
distinct methods which the target interface will utilize.
2b Solitary adapters
Adapts 1 method in the adaptee to 1 required method in the
target.
3a Extrinsic/Forward adapter
Sucks data out of the adaptee for use in the target.
3b Intrinsic/Reverse adapter
Passes data from the target to the adaptee in order to
update itself.
4ai Conversion adapter
Converts a single result or value from the adaptee into the
equivalent value for use by the target. Similar to Imperial-measurement to
Metric-measurement converters or foreign currency converters or wheel-revolutions
to distance covered converters (odometer).
4aii Translating adapter
These adapters perform language and jargon translations,
measurement-converters and also currency-rate converters typify the behavior of
these adapters.
4b Amalgamated adapters
Amalgamates several parameters coming out of the adaptee to
a single unified value going to the client (such as speedometer converting
wheel-turn-numbers and rates into a single speed).
5a Pre-adaptation
Adapts the adaptee to the target preemptively. Most pattern-authors
do not recognize this as a legitimate form of adapter. They argue that adapter
allows variation in classes after-the-fact in contrast to bridge’s accomodation
of variation before-the-fact.
5b Post-adaptation
The ideal target already exists and the adapter converts
subsequent interfaces of adaptees which do not meet the target-interface into
that interface. This is the widely recognized variation.
If you look closely you will realize that pre/post
adaptation has bearing on the concept of symmetrical/asymmetrical adaptation. Arguably,
if we know before hand how the interface needs to look but do not have the
technology to create that interface, then we will symmetrically do
pre-adaptation of all existing systems to the interface which we will target in
the future. That is just one example of a combination of the concepts.