SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Design Pattern
Bridge Pattern
A Structural design pattern




                              Copyright © Astha
The Problem
Suppose a task has been given of writing a program that will draw rectangles
with either of two drawing programs. It also have been told that when
instantiate a rectangle, it will know whether it should use drawing program 1
(DP1) or drawing program 2 (DP2).

The rectangles are defined as two pairs of points, as represented in the
following figure. The differences between the drawing programs are
summarized
in Table below.
                                                     X2, Y2




           X1, Y1
                                                 Copyright © Astha
The Problem
                      DP1                   DP2
 Used to draw a       draw_a_line( x1,      drawline( x1, x2,
 line                 y1, x2, y2)           y1, y2)
 Used to draw a       draw_a_circle( x, y, drawcircle( x, y, r)
 circle               r)


we don’t want the code that draws the rectangles to worry about what
type of drawing program it should use. It occurs to me that because the
rectangles are told what drawing program to use when instantiated, I can
have two different kinds of rectangle objects: one that uses DP1 and one
that uses DP2. Each would have a draw method but would implement it
differently.




                                             Copyright © Astha
The Problem




              Copyright © Astha
The Problem
A straightforward approach: implementing two shapes and two
drawing programs.




                                       Copyright © Astha
The Problem
Bridge in Action




                   Copyright © Astha
Intent
Decouple an abstraction from its implementation so that the two can vary
independently.




                                              Copyright © Astha
Applicability
Use the Bridge pattern when
 you want to avoid a permanent binding between an abstraction and its
implementation. This might be the
case, for example, when the implementation must be selected or switched at
run-time.
 both the abstractions and their implementations should be extensible by
subclassing. In this case, the Bridge
pattern lets you combine the different abstractions and implementations and
extend them independently.
 changes in the implementation of an abstraction should have no impact on
clients; that is, their code should
not have to be recompiled.




                                               Copyright © Astha
Structure




            Copyright © Astha
Participants
‱ Abstraction (Window)
    o defines the abstraction's interface.
    o maintains a reference to an object of type Implementor.
‱ RefinedAbstraction (IconWindow)
    o Extends the interface defined by Abstraction.
‱ Implementor (WindowImp)
    o defines the interface for implementation classes. This interface doesn't
    have to correspond exactly to Abstraction's interface; in fact the two
    interfaces can be quite different. Typically the Implementor interface
    provides only primitive operations, and Abstraction defines higher-level
    operations based on these primitives.
‱ ConcreteImplementor (XWindowImp, PMWindowImp)
    o implements the Implementor interface and defines its concrete
    implementation.




                                                Copyright © Astha
Collaborations
‱ Abstraction forwards client requests to its Implementor object.




                                               Copyright © Astha
Consequences
   Decoupling interface and implementation. An implementation is not bound
    permanently to an interface. The implementation of an abstraction can be
    configured at run-time. It's even possible for an object to change its
    implementation at run-time.
   Improved extensibility. You can extend the Abstraction and Implementor
    hierarchies independently.
   Hiding implementation details from clients. You can shield clients from
    implementation details, like the sharing of Implementor objects and the
    accompanying reference count mechanism (if any).




                                                Copyright © Astha
Implementation
1. Only one Implementor. In situations where there's only one implementation,
   creating an abstract Implementor class isn't necessary. This is a degenerate
   case of the Bridge pattern; there's a one-to-one relationship between
   Abstraction and Implementor. Nevertheless, this separation is still useful
   when a change in the implementation of a class must not affect its existing
   clients—that is, they shouldn't have to be recompiled, just relinked.
2. Creating the right Implementor object. How, when, and where do you decide
   which Implementor class to instantiate when there's more than one?




                                                 Copyright © Astha
Assignment
A document viewer has been made for an enterprise solution (desktop
application), which supports viewing of some specific types of documents. The
supporting types are HTML, Microsoft Word and Microsoft Excel.

Underneath, the document viewer uses an abstract interface of the document
which contains methods to show the document in the viewer.

Now the enterprise application is going to have a web solution where there
would be another document viewer (different in several aspects from the
existing one) with the same functionalities as it is now in the desktop version.

Use the Bridge pattern to solve the problem in such a way that new document
types can be easily incorporated into the system and new type of document
viewer can also be incorporated.




                                                 Copyright © Astha

Weitere Àhnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Prototype design patterns
Prototype design patternsPrototype design patterns
Prototype design patterns
 
Factory Method Pattern
Factory Method PatternFactory Method Pattern
Factory Method Pattern
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Design pattern
Design patternDesign pattern
Design pattern
 
Facade Design Pattern
Facade Design PatternFacade Design Pattern
Facade Design Pattern
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
 
Flyweight pattern
Flyweight patternFlyweight pattern
Flyweight pattern
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
 
Factory Method Pattern
Factory Method PatternFactory Method Pattern
Factory Method Pattern
 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Design Pattern - Factory Method Pattern
Design Pattern - Factory Method PatternDesign Pattern - Factory Method Pattern
Design Pattern - Factory Method Pattern
 
Adapter pattern
Adapter patternAdapter pattern
Adapter pattern
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
 
Design Patterns - Abstract Factory Pattern
Design Patterns - Abstract Factory PatternDesign Patterns - Abstract Factory Pattern
Design Patterns - Abstract Factory Pattern
 
Facade pattern
Facade patternFacade pattern
Facade pattern
 
Bridge pattern for Dummies
Bridge pattern for DummiesBridge pattern for Dummies
Bridge pattern for Dummies
 
Facade Pattern
Facade PatternFacade Pattern
Facade Pattern
 
Prototype pattern
Prototype patternPrototype pattern
Prototype pattern
 
Adapter Pattern
Adapter PatternAdapter Pattern
Adapter Pattern
 

Andere mochten auch

Bridge Pattern Derek Weeks
Bridge Pattern   Derek WeeksBridge Pattern   Derek Weeks
Bridge Pattern Derek Weeks
melbournepatterns
 
Structural Design pattern - Adapter
Structural Design pattern - AdapterStructural Design pattern - Adapter
Structural Design pattern - Adapter
Manoj Kumar
 

Andere mochten auch (15)

Bridge Pattern Derek Weeks
Bridge Pattern   Derek WeeksBridge Pattern   Derek Weeks
Bridge Pattern Derek Weeks
 
Bridge Pattern
Bridge PatternBridge Pattern
Bridge Pattern
 
20120420 - Design pattern bridge
20120420 - Design pattern bridge20120420 - Design pattern bridge
20120420 - Design pattern bridge
 
Chain of Responsibility Pattern
Chain of Responsibility PatternChain of Responsibility Pattern
Chain of Responsibility Pattern
 
Chain of responsibility
Chain of responsibilityChain of responsibility
Chain of responsibility
 
Command Pattern
Command PatternCommand Pattern
Command Pattern
 
Command pattern
Command patternCommand pattern
Command pattern
 
Chain of Responsibility Pattern
Chain of Responsibility PatternChain of Responsibility Pattern
Chain of Responsibility Pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Structural Design pattern - Adapter
Structural Design pattern - AdapterStructural Design pattern - Adapter
Structural Design pattern - Adapter
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
 
Descriptive statistics
Descriptive statisticsDescriptive statistics
Descriptive statistics
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Implementing the Adapter Design Pattern
Implementing the Adapter Design PatternImplementing the Adapter Design Pattern
Implementing the Adapter Design Pattern
 
Security and Integrity of Data
Security and Integrity of DataSecurity and Integrity of Data
Security and Integrity of Data
 

Ähnlich wie Bridge pattern

Design Patterns By Sisimon Soman
Design Patterns By Sisimon SomanDesign Patterns By Sisimon Soman
Design Patterns By Sisimon Soman
Sisimon Soman
 
Ch08lect2 ud
Ch08lect2 udCh08lect2 ud
Ch08lect2 ud
Ahmet Balkan
 
Utilizing Layers in AutoCAD Prototype Package
Utilizing Layers in AutoCAD Prototype PackageUtilizing Layers in AutoCAD Prototype Package
Utilizing Layers in AutoCAD Prototype Package
Brian Mitchell
 
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
sreeja_rajesh
 
Q Cad Presentation
Q Cad PresentationQ Cad Presentation
Q Cad Presentation
vikas mahajan
 

Ähnlich wie Bridge pattern (20)

Design Patterns By Sisimon Soman
Design Patterns By Sisimon SomanDesign Patterns By Sisimon Soman
Design Patterns By Sisimon Soman
 
How to design an application correctly ?
How to design an application correctly ?How to design an application correctly ?
How to design an application correctly ?
 
EMC Documentum xCP 2.0 Design Patterns
EMC Documentum xCP 2.0 Design PatternsEMC Documentum xCP 2.0 Design Patterns
EMC Documentum xCP 2.0 Design Patterns
 
Ch08lect2 ud
Ch08lect2 udCh08lect2 ud
Ch08lect2 ud
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 
Utilizing Layers in AutoCAD Prototype Package
Utilizing Layers in AutoCAD Prototype PackageUtilizing Layers in AutoCAD Prototype Package
Utilizing Layers in AutoCAD Prototype Package
 
Technical-design-for-Angular-apps.pdf
Technical-design-for-Angular-apps.pdfTechnical-design-for-Angular-apps.pdf
Technical-design-for-Angular-apps.pdf
 
React Workshop
React WorkshopReact Workshop
React Workshop
 
NX training Report
NX training ReportNX training Report
NX training Report
 
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
 
Polyline download and visualization over terrain models
Polyline download and visualization over terrain modelsPolyline download and visualization over terrain models
Polyline download and visualization over terrain models
 
Prophecy Of Design Patterns
Prophecy Of Design PatternsProphecy Of Design Patterns
Prophecy Of Design Patterns
 
Programming Without Coding Technology (PWCT) Features - Programming Paradigm
Programming Without Coding Technology (PWCT) Features - Programming ParadigmProgramming Without Coding Technology (PWCT) Features - Programming Paradigm
Programming Without Coding Technology (PWCT) Features - Programming Paradigm
 
The Big Picture - Integrating Buzzwords
The Big Picture - Integrating BuzzwordsThe Big Picture - Integrating Buzzwords
The Big Picture - Integrating Buzzwords
 
Q Cad Presentation
Q Cad PresentationQ Cad Presentation
Q Cad Presentation
 
INTERSHIP PPT.pptx
INTERSHIP PPT.pptxINTERSHIP PPT.pptx
INTERSHIP PPT.pptx
 
Presentation on
Presentation on Presentation on
Presentation on
 
Presentation
Presentation Presentation
Presentation
 
A Uniform Specification Of Mixed Reality Interface Components
A Uniform Specification Of Mixed Reality Interface ComponentsA Uniform Specification Of Mixed Reality Interface Components
A Uniform Specification Of Mixed Reality Interface Components
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 

Mehr von Shakil Ahmed (16)

Algorithm
AlgorithmAlgorithm
Algorithm
 
B-tree & R-tree
B-tree & R-treeB-tree & R-tree
B-tree & R-tree
 
Advanced data structure
Advanced data structureAdvanced data structure
Advanced data structure
 
Observer pattern
Observer patternObserver pattern
Observer pattern
 
Mediator pattern
Mediator patternMediator pattern
Mediator pattern
 
Facade pattern
Facade patternFacade pattern
Facade pattern
 
Proxy pattern
Proxy patternProxy pattern
Proxy pattern
 
iOS 5
iOS 5iOS 5
iOS 5
 
Ios development
Ios developmentIos development
Ios development
 
Graph
GraphGraph
Graph
 
Lowest common ancestor
Lowest common ancestorLowest common ancestor
Lowest common ancestor
 
Segment tree
Segment treeSegment tree
Segment tree
 
Tree & bst
Tree & bstTree & bst
Tree & bst
 
Trie tree
Trie treeTrie tree
Trie tree
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Advanced Search Techniques
Advanced Search TechniquesAdvanced Search Techniques
Advanced Search Techniques
 

KĂŒrzlich hochgeladen

Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

KĂŒrzlich hochgeladen (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Bridge pattern

  • 1. Design Pattern Bridge Pattern A Structural design pattern Copyright © Astha
  • 2. The Problem Suppose a task has been given of writing a program that will draw rectangles with either of two drawing programs. It also have been told that when instantiate a rectangle, it will know whether it should use drawing program 1 (DP1) or drawing program 2 (DP2). The rectangles are defined as two pairs of points, as represented in the following figure. The differences between the drawing programs are summarized in Table below. X2, Y2 X1, Y1 Copyright © Astha
  • 3. The Problem DP1 DP2 Used to draw a draw_a_line( x1, drawline( x1, x2, line y1, x2, y2) y1, y2) Used to draw a draw_a_circle( x, y, drawcircle( x, y, r) circle r) we don’t want the code that draws the rectangles to worry about what type of drawing program it should use. It occurs to me that because the rectangles are told what drawing program to use when instantiated, I can have two different kinds of rectangle objects: one that uses DP1 and one that uses DP2. Each would have a draw method but would implement it differently. Copyright © Astha
  • 4. The Problem Copyright © Astha
  • 5. The Problem A straightforward approach: implementing two shapes and two drawing programs. Copyright © Astha
  • 6. The Problem Bridge in Action Copyright © Astha
  • 7. Intent Decouple an abstraction from its implementation so that the two can vary independently. Copyright © Astha
  • 8. Applicability Use the Bridge pattern when  you want to avoid a permanent binding between an abstraction and its implementation. This might be the case, for example, when the implementation must be selected or switched at run-time.  both the abstractions and their implementations should be extensible by subclassing. In this case, the Bridge pattern lets you combine the different abstractions and implementations and extend them independently.  changes in the implementation of an abstraction should have no impact on clients; that is, their code should not have to be recompiled. Copyright © Astha
  • 9. Structure Copyright © Astha
  • 10. Participants ‱ Abstraction (Window) o defines the abstraction's interface. o maintains a reference to an object of type Implementor. ‱ RefinedAbstraction (IconWindow) o Extends the interface defined by Abstraction. ‱ Implementor (WindowImp) o defines the interface for implementation classes. This interface doesn't have to correspond exactly to Abstraction's interface; in fact the two interfaces can be quite different. Typically the Implementor interface provides only primitive operations, and Abstraction defines higher-level operations based on these primitives. ‱ ConcreteImplementor (XWindowImp, PMWindowImp) o implements the Implementor interface and defines its concrete implementation. Copyright © Astha
  • 11. Collaborations ‱ Abstraction forwards client requests to its Implementor object. Copyright © Astha
  • 12. Consequences  Decoupling interface and implementation. An implementation is not bound permanently to an interface. The implementation of an abstraction can be configured at run-time. It's even possible for an object to change its implementation at run-time.  Improved extensibility. You can extend the Abstraction and Implementor hierarchies independently.  Hiding implementation details from clients. You can shield clients from implementation details, like the sharing of Implementor objects and the accompanying reference count mechanism (if any). Copyright © Astha
  • 13. Implementation 1. Only one Implementor. In situations where there's only one implementation, creating an abstract Implementor class isn't necessary. This is a degenerate case of the Bridge pattern; there's a one-to-one relationship between Abstraction and Implementor. Nevertheless, this separation is still useful when a change in the implementation of a class must not affect its existing clients—that is, they shouldn't have to be recompiled, just relinked. 2. Creating the right Implementor object. How, when, and where do you decide which Implementor class to instantiate when there's more than one? Copyright © Astha
  • 14. Assignment A document viewer has been made for an enterprise solution (desktop application), which supports viewing of some specific types of documents. The supporting types are HTML, Microsoft Word and Microsoft Excel. Underneath, the document viewer uses an abstract interface of the document which contains methods to show the document in the viewer. Now the enterprise application is going to have a web solution where there would be another document viewer (different in several aspects from the existing one) with the same functionalities as it is now in the desktop version. Use the Bridge pattern to solve the problem in such a way that new document types can be easily incorporated into the system and new type of document viewer can also be incorporated. Copyright © Astha