# Factory Method Pattern

> A design pattern in which a base class calls an overridable method to create the objects its workflow uses.

Record: `architecture:factory-method-pattern`
Kind: pattern
Layer: [Design Patterns Core](https://banes-lab.com/records/layer/design-patterns-core.md)
Severity: contextual
Scope: class hierarchy, framework
Canonical: https://banes-lab.com/ontology#architecture-factory-method-pattern

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

## Repair

- Refactored by: Introduce Factory Method
- Detected by: base class directly instantiates variant
- Violated by: fixed construction in base workflow
- Measured by: variant construction duplication
- Enforced by: [design review](https://banes-lab.com/records/architecture/design-review.md)

## Requires

- [Subclass-Controlled Creation](https://banes-lab.com/records/lexicon/subclass-controlled-creation.md)

## Reinforces

- [Open/Closed Principle (OCP)](https://banes-lab.com/records/architecture/open-closed.md)

## Enables

- [Deferred Instantiation](https://banes-lab.com/records/lexicon/deferred-instantiation.md)

## Conflicts with

- [Concrete Constructor Coupling](https://banes-lab.com/records/lexicon/concrete-constructor-coupling.md)

## In tension with

- [Inheritance Complexity](https://banes-lab.com/records/lexicon/inheritance-complexity.md)

## Tensions

- [Factory Method Pattern / Inheritance Complexity](https://banes-lab.com/records/tension/factory-method-pattern-inheritance-complexity.md)

## Severity

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

## Category

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

## Linked from

- [SOLID / Object-Oriented Design](https://banes-lab.com/ontology/principles/architecture-category-solid-object-oriented-design.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)
