Creational Patterns

Patterns focus on flexible and controlled object creation, often using interfaces, functions, and struct composition rather than traditional class-based inheritance.

1. Functional Options

Uses variadic option functions to configure an object.

2. Configuration Struct + Factory

Mimics traditional builders with method chaining.

3. Configurable Object

Allows an object to be created with default values and then configured step-by-step through setter methods.

4. Lazy Initialization

Delays object creation until it’s needed.

5. Fluent Interfaces

Chaining method calls on the same object, often seen in SQL builders or HTTP clients.

Creational Patterns


Table of contents


This site is open source! You can contribute or suggest changes by editing the GitHub repository.
Copyright © 2025. Distributed by an MIT license.