Connection is used when we need to decouple a concept from its implementation so that the two can vary separately. This type of design pattern comes under structural pattern as this pattern decouples implementation class and summary class by providing a bridge structure between them.
This pattern involves an interface which acts as a bridge which makes the functionality of concrete class’s independent from interface implementer classes. Both types of classes can be transformed structurally without moving each other.
We are representing use of Bridge pattern via following instance in which a circle can be drawn in different colours using same abstract class process but different bridge implementer course.
We have a DrawAPI interface which is temporary as a bridge implementer and concrete classes Red Circle, Green Circle implementing the DrawAPI interface. Shape is a summary class and will use entity of DrawAPI. BridgePatternDemo, our assembly class will use form class to draw changed collared circle.
Construct bridge implementer interface.
Create concrete bridge implementer classes implement the DrawAPIinterface.
Form an abstract class form using the DrawAPI interface.
Create concrete class implementing the Shape interface.
Apply the Shape and DrawAPI classes to draw dissimilar collared circles.
Verify the output.
Design Patterns Related Interview Questions
|Java Script Interview Questions||AJAX Interview Questions|
|Graphic Design Interview Questions||Adobe Indesign Interview Questions|
|Java-Multithreading Interview Questions||Database Design Interview Questions|
|Compiler Design Interview Questions||CSS Advanced Interview Questions|
|Java Design Patterns Interview Questions||Hardware design Interview Questions|
|Material Design Lite Interview Questions||Object Oriented Analysis and Design Interview Questions|
|Standard Template Library (STL) Interview Questions|
Design Patterns Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.