Skip to content

Factory

Stable ID: pattern.factory
Kind: design-pattern
Status: stable
Source: skill/references/design-patterns/factory.md

Purpose

Centralise object selection or construction policy when callers should not know concrete creation details.

Use when

  • Construction varies by configuration, environment, or capability.
  • Creation requires coordinated dependencies or validation.

Avoid when

  • Direct construction is stable and obvious.
  • The factory only forwards arguments to one constructor.

Applicability

  • Languages: any, python, q-kdbplus, cpp, rust, dart-flutter, typescript
  • Related entries: decision.factory-vs-direct-construction, component.plugin-system