title | toc | date |
---|---|---|
14 Builder Pattern |
false |
2017-10-30 |
Use the Builder Pattern(构建器模式) to encapsulate the construction of a product and allow it to be constructed in steps. 使用构建器模式封装一个产品的构造过程,并允许按步骤制造。
例如旅客度假时,可以选择各种旅馆、门票、餐厅预订等。但每个旅客的度假计划一般都不一样,如何才能提供一种方式来创建度假计划呢?
参见[[Effective Java - Creating and Destroying Objects](../Effective Java/2 Creating and Destroying Objects.md##item-2-consider-a-builder-when-faced-with-many-constructor-parameters)]