GoF classification, the five creational patterns, and the question each one answers about what varies when an object is built.
| Pattern | Scope | Intent |
|---|---|---|
| Factory Method | Class | Define a creation operation and let subclasses choose the concrete product |
| Abstract Factory | Object | Create families of related products without naming concrete classes |
| Builder | Object | Build a complex object step by step, separating construction from representation |
| Prototype | Object | Create new objects by copying a configured prototype |
| Singleton | Object | Ensure one instance with a well-known access point |
new to an overridable factory methodbuild() — the one point where the object is completegetInstance() is not thread-safe| What varies | Pattern |
|---|---|
| Many kinds of one product, chosen by extension | Factory Method |
| Families of products that must stay consistent | Abstract Factory |
| One product with many optional parts or representations | Builder |
| Expensive or run-time-configured setup to reuse | Prototype |
| Singularity is a genuine invariant | Singleton |