9.3. Adapter

Intent

Transform calls on one interface into calls on another, incompatible, interface without changing existing components.

AKA

Emulator [Buschmann et al., 1996]

9.3.1. Problem

9.3.1.1. Context

There is a pre-existing component, the adaptee, which exposes an interface that you wish to use via an alternative incompatible interface, the target.

9.3.1.2. Summary

You need to resolve one or more of the following:

  • You wish to reduce your development costs by porting a pre-existing component, the adaptee, to a new environment.

  • You have re-engineered a component, the adaptee, but you wish to support the old interface, the target, to preserve compatibility for legacy clients.

  • You wish to increase the functionality and flexibility of a component by re-using existing components, the adaptees, at run time.

9.3.1.3. Description

This pattern was originally described in [Gamma et al., 1994]. Hence in this discussion rather than examine the pattern itself in too much detail, we place emphasis on how it can be used on Symbian OS, covering a range of diverse circumstances.

The context of this pattern of having to match incompatible interfaces can arise in numerous different situations. Software based on Symbian OS is subject to many pressures all of which can give rise to problems of mismatching interfaces: it is an evolving system with a large user base, which means that maintaining interface compatibility from release to release is important not just for the operating system ...

Get Common Design Patterns for Symbian OS: The Foundations of Smartphone Software now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.