Thursday, May 18, 2017

Bridge Design Pattern

The Bridge pattern is designed to separate a class's interface from its implementation so you can vary or replace the implementation without changing the client code (see the Bridge pattern Wikipedia entry).

Lets see what that means in a simpler way.

In following example polymorphism is used inorder to give Person Class different implementations.

---
There are lot of people by same name. Say we want to introduce a new property home town.
If we follow this pattern code would be as follows.

---
That is code is hard to maintain and reusability is low. We can use Bridge design pattern to improve that code by seperating implementation of home town.
---
---

Optimize you working enviorenment : Single command to create & move to a directory in linux (C Shell, Bash)

Usually move to a directory just after creating is bit of a anxious task specially if the directory name is too long. mkdir long-name-of...