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.
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.
---
---
No comments:
Post a Comment