Описание тега builder

An object creation software design pattern, one of the Gang of Four's creational design patterns.

The Builder design pattern separates the construction of a complex object from its representation.

It has two common variations:

  • The pattern as outlined in the book "Design Patterns" by the "Gang of Four" (Gamma, Helm, et al) (an example can be found on the Wikipedia page)
  • The pattern as outlined in the book "Effective Java" by Joshua Bloch ( Example)

The latter is in many ways a consolidation of the participants in the GoF pattern. For example, the director is typically the product, and there is typically no "abstract builder", only a single concrete builder.

Builder is usually very helpful in solving the problem of telescoping constructors by reducing the combinations of constructors required for optional construction-time fields.

This is one of the Gang of Four's creational design-patterns, first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".