I am preparing for SCEA, i am unable to find the difference between Builder and Bridge pattern (other then creational and structural) since both of them doing the same.
1. Keep common functionality in abstract class.
2. Vary Implementations(functionality) keep it in sub classes, that means this method would declare as abstract in abstract class (previous step (1))
Can any please explain?
posted 3 years ago
Builder and Bridge patterns solve a different purpose. Builder pattern is used when the construction of an Object is more complex than just saying new ....(). Imagine that a house needs to be constructed based on various designs, choices and amenities selected by the customer. In this case, typically you will use Builder pattern to "CONSTRUCT" the house PER CUSTOMER based on various choices selected by her. Hence, the creation of the House object or end product is complex based on external factors.
On the other hand, Bridge pattern is used vary the abstraction and implementation seamlessly. Suppose there is a car demo for, say, Sports car and economy car. You would like to seamlessly switch between the two so that Client code is not affected. You can go through examples from the Web.