The players in this pattern are:
1. Product (Room)
Represents the complex object which includes many classes(parts)
2. Builder (RoomBuilder)
Specifies an abstract class or an interface for creating parts of a Product object
3. ConcreteBuilder (WoodBuilder, GlassBuilder)
- Constructs parts of the product by implementing the Builder class/interface
- provides a way for retrieving the product
Constructs an object (room) using the Builder class/interface
So, you use the Builder pattern when:
- the object to be constructed has many parts and might have different representations.
- you need control over the construction process.