-
Book Overview & Buying
-
Table Of Contents
TypeScript Design Patterns
By :
Bridge Pattern decouples the abstraction manipulated by clients from functional implementations and makes it possible to add or replace these abstractions and implementations easily.
Take a set of cross-API UI elements as an example:

We have the abstraction UIElement that can access different implementations of UIToolkit for creating different UI based on either SVG or canvas. In the preceding structure, the bridge is the connection between UIElement and UIToolkit.
The participants of Bridge Pattern include:
UIElementDefines the interface of objects to be manipulated by the client and stores the reference to its implementer.
TextElement, ImageElementExtends abstraction with specialized behaviors.
UIToolkitDefines the interface of a general implementer that will eventually carry out the operations defined in abstractions. The implementer usually cares only about basic operations while the abstraction will handle...