The intent of this pattern is to decouple abstraction from implementation so that the two can vary independently.
This seems to be like confusing statement to the readers. Since abstraction do always have implementation. Implementation is derived from abstraction. Abstract interface will have implementation. So in a sense implementation is tied to abstract interface.
But in above pattern, abstraction and implementation are totally used in different context. It does not means here the writer is talking same implementation of that abstraction. In reality, this abstraction and implementation are independent of each other. It's like they are overriding the meaning of abstraction and implementation.
If you are one of those who agree to above my point of view or understand better than me enough to clear me. do post.
The example I always use for Bridge is a light and light switch:
The light switch is the abstraction: you want the light to be turned on or off, or perhaps use a dimmer. The 2 abstractions are thus an on/off switch and a dimmer.
The actual light itself is the implementation: it might be a light bulb (bad for environment), an LED or a halogen light. It implements your light requirement: it will turn on or off, or give 50% light if you've set your dimmer half way.
I agree that the word 'abstraction' is somewhat confusing, as it is normally used in the context of interfaces and inheritance.
Hope this helps
'Design Patterns for Java' trainer
Joined: Jul 17, 2008
Thanks for reply.
I got your very good example. This example means to me that you can multiple version of light like bulb, led, tube etc and so you can multiple versions of light switch like dimmer, on/off.
These multiple versions of light and light switch can work together through bridge. Since light and light switch can have multiple versions, this means they can vary independently.