Let’s pass the Bridge

Hello everyone! This is my first CS blog post so let’s cross the bridge and get to know more about Software. In this first blog post I will be writing about design patterns and in particular about the Bridge, the bridge design pattern of course!! What were you thinking?!

To start with, I want to talk a bit about design patterns, what are and how important are they. A design pattern is simply a solution of an occurring problem in software design. Think of a design pattern as a template that will help you to solve your problem. How important are they? VERY!

If you have a problem, what are you going to do about it if you don’t have a solution!? Once you get to know the most important design patterns, you will be able to understand which one to use just by understanding the problem well. But what is the damage of choosing the wrong design pattern? Actually, it is a pretty big problem to have the wrong design pattern to fit for your problem. Having the wrong design pattern will bring you to a very complex solution and if you are working with other people it will be very hard for them to understand your solution or even might give them a wrong understanding of it. BIG PROBLEM!

In class of CS 343 we have talked about some of the most important design patterns used and here I will talked about another one. The Bridge Design Pattern is introduced by the Gang Of Four and is used in software to encapsulate an implementation class inside an interface class.  The Bridge design patters helps solving problems: when abstraction and implementation should be defined and extended independently; when the implementation needs to be selected at run time by avoiding a compile time binding between an abstraction and implementation. Some other advantages of The Bridge are that it can be used to map orthogonal class hierarchies and is designed up front to let the abstraction and implementation be independently of each other. The Bridge Design Pattern is a composite of the Template and Strategy design patterns.

It is considered that the Bridge Design Pattern is very similar with the Adapter design pattern. The biggest difference is that the Adapter Design Pattern is used to convert the interface between classes with less inheritance, but the Bridge Design Pattern decouple an abstraction class from its implementation.

The reason why I choose to talk about this design pattern is that I found it interesting to know about a similar design of Adapter Design.  Software engineers face different problems all the time and it is good to know about different type of design patterns in order to have the perfect solution for a problem.

Resources and example of Bridge Design Pattern:
1. https://www.geeksforgeeks.org/bridge-design-pattern/

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s