Adapter Pipeline

Structurally, the Adapter pattern is a class that implements an interface by (a small transformation and) delegating to another class. However, this class structure is useful for more than just connecting two slightly-incompatible interfaces together.

A pipeline of adapters is sometimes an excellent way of decomposing a computation. For example, it is a reasonable design for a compiler.

This pattern is good for testability. In unit tests, one can test each section of the pipeline individually. In debugging integration problems, one can listen at any boundary by writing a decorator for that boundary's interface. If some of the interfaces are the same, it may allow arranging the sections of the pipeline in a different order.


EditText of this page (last edited July 16, 2007) or FindPage with title or text search