skip to Main Content

Welcome

Say hello to the toggle bar. This is an optional section you can use to display any content you'd like. Simply select a page from the theme panel and the content of the page will display here. You can even use the drag and drop builder to create this! This is a perfect place for your company mission statement, alerts, notices or anything else.

Get In Touch

Email: support@total.com
Phone: 1-800-Total-Theme
Address: Las Vegas, Nevada

Our Location

togglebar-map

Bridge Pattern

Post Series: Structual Design Pattern

Bridge pattern is used to separate an abstraction from its implementation so that both can be modified independently.  Bridge pattern has nearly the same structure as the Adapter Pattern. But it is used when designing new systems instead of the Adapter pattern which is used with already existing systems.

 

Abstraction: This is an abstract class and containing members that define an abstract business object and its functionality. It contains a reference to an object of type Bridge. It can also acts as the base class for other abstractions.
Redefined Abstraction: This is a class which inherits from the Abstraction class. It extends the interface defined by Abstraction class.
Bridge: This is an interface which acts as a bridge between the abstraction class and implementer classes and also makes the functionality of implementer class independent from the abstraction class.
ImplementationA & ImplementationB: These are classes which implement the Bridge interface and also provide the implementation details for the associated Abstraction class.

Implement

Usage

  1. Abstractions and implementations should be modified independently.
  2. Changes in the implementation of an abstraction should have no impact on clients.
  3. The Bridge pattern is used when a new version of a software or system is brought out, but the older version of the software still running for its existing client. There is no need to change the client code, but the client need to choose which version he wants to use.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top