Enterprise Integration Zone is brought to you in partnership with:

Cristian Chiovari is a Senior Software Engineer specialized in developing enterprise software applications with experience on software integration and messaging. His expertise include helping clients build software using industry best practices, Test Driven Design, Weblogic, Oracle Service Bus , Spring Frameworks, JEE. Performance improvements is something that is really passionate about and considers software development not only his job but also his main hobby. Cristian is a DZone MVB and is not an employee of DZone and has posted 10 posts at DZone. You can read more from them at their website. View Full User Profile

The Bridge Pattern

10.18.2012
| 6023 views |
  • submit to reddit

Description:

Decouples abstraction from implementation. Inheritance tightly couples an abstraction with an implementation at compile time. The Bridge pattern can be used to avoid binding between abstraction and implementation and to select the implementation at runtime.

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

Example:

If you have a Car hierarchies of classes ,it can become extremely big like in the below diagram.

Benefits:

  • Defines class hierarchies consisting of primitive objects and composite objects
  • Makes it easier to add new kinds of components
  • Provides flexibility of structure and a manageable interface

When to use:

  • You want to represent the whole hierarchy or a part of the hierarchy of object
  • You want clients to be able to ignore the difference between compositions of objects and individual objects
  • The structure can have any level of complexity and is dynamic.

Diagram:

Or

Published at DZone with permission of Cristian Chiovari, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Edward Villanueva replied on Sat, 2013/12/21 - 12:11am

Simple but very impressive diagram. miami 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.