Select, implement, compare, teach, or review the five classic creational design patterns: Factory Method, Abstract Factory, Builder, Prototype, and Singleton. Use when object construction, compatible product families, complex assembly, cloning, instance lifetime, or creation coupling is the central design pressure.
Select, implement, compare, teach, or review the five classic creational design patterns: Factory Method, Abstract Factory, Builder, Prototype, and Singleton. Use when object construction, compatible product families, complex assembly, cloning, instance lifetime, or creation coupling is the central design pressure.
Creational design patterns
Read references/patterns.md before making a recommendation or reviewing an implementation.
Workflow
Identify what varies: one product, a product family, assembly steps, initial state, or lifetime.
Establish whether a constructor, function, or dependency injection already solves the problem.
Choose the narrowest matching pattern and name a credible alternative.
Keep selection and construction at the composition boundary when possible.
Preserve product invariants and make ownership or lifetime explicit.
Test the promised variation: add a fake product, switch a family, build a variant, clone safely,
or prove instance cardinality under concurrency.
Use the language's natural construction tools. A pattern's collaboration matters more than class
names or inheritance.