Factory Method
Factory Method separates object creation from the workflow that uses the object, allowing a subtype or configuration to choose the concrete product.
Visual logic for real ideas
We do not compress a book into a summary. We take one useful idea, model it as a system, run an example, and show where it stops working.
Launch collection 01
Ten reusable software ideas from one source book, rebuilt as original logic flows, practical examples, and explicit trade-offs.
Creational
Factory Method separates object creation from the workflow that uses the object, allowing a subtype or configuration to choose the concrete product.
Singleton guarantees one globally reachable instance, but the convenience behaves like shared global state and must be treated as a trade-off.
Structural
Decorator wraps an object with optional layers, allowing capabilities to be combined at runtime without creating a subclass for every combination.
Adapter converts an existing interface into the interface a client expects, containing incompatibility at one explicit system boundary.
Facade offers a small task-oriented interface over a complicated subsystem, reducing the knowledge each caller needs for common workflows.
Behavioral
When one task has several valid ways to run, Strategy keeps the workflow stable while the decision-making rule can change independently.
Observer turns a state change into a broadcast so multiple dependents can react without the source knowing their concrete implementations.
Command packages a request as an object so actions can be queued, logged, retried, composed, or reversed independently from the caller.
Template Method defines a stable algorithm sequence while allowing selected steps to vary through subclass hooks or overrides.
Iterator provides a standard way to traverse a collection while hiding whether the underlying structure is an array, tree, stream, or remote page.