Design Patterns - Bridge PDF download

Decouple an abstraction from its implementation so that the two can vary independently.

This is one of my favorite Design Patterns and I've used it quite often when coding with GUI's. It allows you to completely seperate your GUI and your implementations of reactions to user input. For example, instead of calling a Windows MessageBox directly:

C#:
  1. MessageBox.Show("bla","blub");

You create a "Bridge" class with a public "showMessageBox" function. You then have various classes for Windows, Mac, etc. which implement a message box for that specific OS. The Bridge class then serves as a bridge between your implementation and the specific implementations for the various OS's.