# Builder pattern
## Problem
To build a simple house, you need to construct four walls and a floor, install a door, fit a pair of windows, and build a roof.
But what if you want a bigger, brighter house, with a backyard and other goodies (like a heating system, plumbing, and electrical wiring)?
### extend the base House class

you’ll end up with a considerable number of subclasses.
## another approach

In most cases most of the parameters will be unused, making the constructor calls pretty ugly.
## Solution: Builder pattern

```
builder.buildWalls()
builder.buildDoors()
builder.buildWindows()
builder.buildRoof()
# Add garage
builder.buildGarage()
house = builder.getResult()
```
## when you need to build various representations of the product

## Director

Director: defines the order in which to execute the building steps
Builder: provides the implementation for those steps.
(Having a director class in your program isn’t strictly necessary)

## Pseudocode

## Applicability
1. Use the Builder pattern to get rid of a “telescoping constructor”.

2. Use the Builder pattern when you want your code to be able to create different representations of some product (for example, stone and wooden houses).

3. Use the Builder to construct Composite trees or other complex objects.

## Builder vs Abstract Factory

