In June I continued my series of design patterns examples using PHP
5 with the Adapter Pattern. Here now is my 17th design pattern
example, the Bridge Pattern.
In the Bridge Pattern we have an abstraction and implementation in
different class hierarchies.
Not something I use all the time, but if you have a situation where a
class varies functionality based on two completely independent needs
it can be useful.
The classis GOF* implementation has a class needing to create
different windows on different platforms. So, you don't need to redo
anything about the platofrms when you add a new type of window or vice
versa.
*GOF - Gang of Four, referring to the four authors of "Elements of
Reusable Object-Oriented Software".
5 with the Adapter Pattern. Here now is my 17th design pattern
example, the Bridge Pattern.
In the Bridge Pattern we have an abstraction and implementation in
different class hierarchies.
Not something I use all the time, but if you have a situation where a
class varies functionality based on two completely independent needs
it can be useful.
The classis GOF* implementation has a class needing to create
different windows on different platforms. So, you don't need to redo
anything about the platofrms when you add a new type of window or vice
versa.
*GOF - Gang of Four, referring to the four authors of "Elements of
Reusable Object-Oriented Software".
Comment