Skip to content

Factory or Direct Construction

Stable ID: decision.factory-vs-direct-construction
Kind: decision-record
Status: stable
Source: skill/references/decisions/factory-vs-direct-construction.md

Purpose

Choose a factory only when object selection or coordinated construction policy should be hidden from callers.

Use when

  • A design choice matches the question described by this decision record.

Avoid when

  • The documented alternatives do not match the actual source of variation or ownership.

Applicability

  • Languages: any, python, q-kdbplus, cpp, rust, dart-flutter, typescript
  • Related entries: pattern.factory