Design Pattern - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Design Pattern

Description:

Title: Design Pattern Bridge Author: Yih-shoung Chen Last modified by: Tulika Rathi Created Date: 5/14/2000 3:35:26 PM Document presentation format – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 12
Provided by: Yihs9
Category:

less

Transcript and Presenter's Notes

Title: Design Pattern


1
Design Pattern Bridge(Structural)
  • References
  • Yih-shoung Chen, Department of Information
    Engineering, Feng Chia University,Taiwan, R.O.C.
  • The Bridge Pattern, SENG 609.04 Design Patterns,
    University of Calgary
  • The Bridge Pattern, CpSc 872 Software Engineering
  • Gamma, E., R. Helm, R. Johnson, J. Vlissides.
    Design Patterns Elements of Reusable
    Object-Oriented Software.

2
Intent
  • Decouple an abstraction from its implementation
    so that the two can vary independently
  • Allows different implementations of an interface
    to be decided upon dynamically.
  • Also known as Handle/Body pattern

3
Motivation Applicability
  • Avoid a permanent binding between an abstraction
    and its implementation
  • Both the abstractions and their implementation
    should be extensible by subclassing
  • Changes in the implementation of an abstraction
    do not impact the clients
  • Share an implementation among multi objects and
    this facts should be hidden from the client
  • E.g. Windows

4
Participants
  • Abstraction
  • Refined abstraction
  • Concrete implementor
  • Implementor

5
Structure
6
Example of problem suitable for bridge
7
A more complex situation
8
Solution using Bridge
9
Pros Cons
  • Pros
  • decoupling of the implementation from the
    interface
  • improved extensibility of classes
  • additional capability for hiding implementation
    details from clients
  • best leveraged as a pure design-time pattern
  • Cons (Implementation Issues)
  • abstractions that have only one implementation
  • creating the right Implementor
  • sharing implementors
  • use of multiple inheritance

10
Adapter vs Bridge
  • Similarities
  • Both used to hide the details of the underlying
    implementation.
  • Difference
  • The adapter pattern is geared towards making
    unrelated components work together
  • Applied to systems after theyre designed
    (reengineering, interface engineering).
  • A bridge, on the other hand, is used up-front in
    a design to let abstractions and implementations
    vary independently.
  • Green field engineering of an extensible system
  • New beasts can be added to the object zoo,
    even if these are not known at analysis or system
    design time.
  • Structural difference Bridge can abstract a
    complex entity from its implementation Adapter
    only abstracts a single interface

11
Thank You
Write a Comment
User Comments (0)
About PowerShow.com