# Builder Pattern

> A design pattern that assembles a complex object step by step through named calls and validates it when it is built.

Record: `architecture:builder-pattern`
Kind: pattern
Layer: [Design Patterns Core](https://banes-lab.com/records/layer/design-patterns-core.md)
Severity: recommended
Scope: object construction, API
Canonical: https://banes-lab.com/ontology#architecture-builder-pattern

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Abstract Factory Pattern](https://banes-lab.com/records/architecture/abstract-factory-pattern.md) and before [Prototype Pattern](https://banes-lab.com/records/architecture/prototype-pattern.md).

## Repair

- Refactored by: Introduce Builder
- Detected by: high-arity constructors
- Violated by: constructors with many optional params
- Measured by: constructor parameter count
- Enforced by: API review

## Requires

- [Complex Construction](https://banes-lab.com/records/lexicon/complex-construction.md)

## Reinforces

- [Intent-Revealing Interface](https://banes-lab.com/records/architecture/intent-revealing-interface.md)

## Enables

- [Valid Object Creation](https://banes-lab.com/records/lexicon/valid-object-creation.md)

## Conflicts with

- [Telescoping Constructor](https://banes-lab.com/records/lexicon/telescoping-constructor.md)

## In tension with

- [Boilerplate](https://banes-lab.com/records/lexicon/boilerplate.md)

## Tensions

- [Builder Pattern / Boilerplate](https://banes-lab.com/records/tension/boilerplate-builder-pattern.md)

## Severity

- [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)

## Category

- [Creational Patterns](https://banes-lab.com/records/architecture-category/creational-patterns.md)

## Linked from

- [Schema / Canonical Data / Semantics](https://banes-lab.com/ontology/principles/architecture-category-schema-canonical-data-semantics.md)
- [Core Vocabulary](https://banes-lab.com/ontology/lexicon/lexicon-category-core-vocabulary.md)
- [Creational Patterns](https://banes-lab.com/ontology/lexicon/lexicon-category-creational-patterns.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The resolutions](https://banes-lab.com/ontology/schema/the-resolutions.md)
