Example: OpenBook
The Bridge pattern gives us a nice opportunity to extend a previous example and to show different patterns interacting. Let's consider the SpaceBook system again. Suppose a developer is working on a new version of SpaceBook called OpenBook. The main feature of OpenBook is that it does not require password authentication. It also does not bother with lazy instantiation, as it is assumed that all OpenBook users will get onto the system straightaway. OpenBook is thus replacing the proxy level of SpaceBook but not the guts of it, and it is certainly the intention that users of both systems should be able to see each other's pages.
Therefore, we have a design where MyOpenBook
and MySpaceBook
need to implement a common
interface. We shall call this the Bridge
interface. The Abstraction
is what is commonly called a
Portal
. It keeps a copy of the
appropriate type of book
object ...
Get C# 3.0 Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.