Separate a varying Entity from its varying Behavior, so that the two can vary independently. Another way to state the intent is, the Bridge is one variation using another variation in a varying way.
One common use of the Bridge is in data access frameworks. The varying Entities would be elements of the system that needed to access data in different ways (such as sequentially, random access). The varying Behaviors would be the different data sources that actually store, retrieve, delete, and update data in different ways.
The idea is to be able to add new data consumers or new data providers without this effecting the other in each case. This makes the system open-closed to a new consumer, or a new provider, or both.
Qualities and principles
Entities only consume, Behaviors only provide, yielding strong cohesion and separation of concerns.
Entities couple only to the Behavioral interface. Clients couple only to the Entity interface. Any potential redundancies can be pushed up to base classes.
Entities, Behaviors, and the way Entities use Behaviors are all hidden from clients. As a result, new Entities and new Behaviors can added to the system with little or no change to existing code.
Testing the Behaviors is straightforward as they have no dependencies. Testing an Entity requires a Mock Behavior.
Questions and concerns
Adding a new Entity is also usually straightforward, unless the new Entity requires something of the Behaviors that is not currently in the interface. When this occurs the interface of the Behaviors must be changed, and thus all existing Behaviors must be updated as well.
This is Scott Bain. Visit us at www.netobjectives.com.