Bridge Pattern — ELI5

Imagine you have a remote control and a TV. The remote decides what to do — change channel, adjust volume, power on. The TV decides how to do it — which signals to send, which circuits to activate.

Now here’s the clever part: that same remote could work with any TV brand. And any TV could work with any remote. They’re connected, but not glued together.

That’s the Bridge Pattern. It separates two things that could change independently: what you want to do and how it gets done.

Without a bridge, you’d need a Samsung remote for a Samsung TV, an LG remote for an LG TV, a Sony remote for a Sony TV. Add a new TV brand? Build another remote. Add a new feature to the remote? Rebuild it for every TV brand. The combinations explode.

With a bridge, the remote just says “change to channel 5” and the TV figures out how. You can swap TVs without touching the remote. You can upgrade the remote without touching the TV.

In code, this shows up when you have two independent reasons your code might change. Maybe you have shapes (circles, squares) and rendering targets (screen, printer, PDF). Without a bridge, you’d need ScreenCircle, PrinterCircle, PDFCircle, ScreenSquare… you see where this is going. With a bridge, shapes and renderers evolve separately.

The one thing to remember: The Bridge Pattern keeps two independent dimensions of change from tangling together — so adding options to one side doesn’t force changes on the other.

pythondesign-patternsoop

See Also

  • Python Adapter Pattern How Python's Adapter Pattern works like a travel power plug — making incompatible things work together.
  • Python Builder Pattern Why building complex Python objects step by step beats cramming everything into one giant constructor.
  • Python Composite Pattern How the Composite Pattern lets you treat a group of things the same way you'd treat a single thing in Python.
  • Python Facade Pattern How the Facade Pattern gives you one simple button instead of a confusing control panel in Python.
  • Python Flyweight Pattern How the Flyweight Pattern saves memory by sharing common data instead of copying it thousands of times.