Structural

Bridge

Description

Splits a large class or a set of closely related classes into two separate hierarchies—abstraction and implementation—which can be developed independently.

Where to use

  • Cross-platform apps.
  • \n
  • Decoupling interface from device.

Real World Example

A 'RemoteControl' (Abstraction) works with a 'TV' (Implementation). You can add new Remotes or new TVs without breaking each other.

Code Example

class Bridge:\n    def __init__(self):\n        pass\n\n    def execute(self):\n        print('Executing Bridge')