You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Prototype](https://github.com/HowProgrammingWorks/PrototypePattern) do not confuse with [Prototype-programming](https://github.com/HowProgrammingWorks/Prototype)
-[Abstract factory](https://github.com/HowProgrammingWorks/AbstractFactory) — creates related objects belonging to one family without specifying their concrete classes, e.g., UI components for different platforms.
14
+
-[Builder](https://github.com/HowProgrammingWorks/Builder) — step-by-step assembly of a complex configurable object, often using chaining, e.g., Query Builder or Form Generator.
15
+
-[Factory](https://github.com/HowProgrammingWorks/Factory) — function or method that creates objects using different techniques: assembling from literals and methods, mixins, setPrototypeOf.
16
+
-[Factory Method](https://github.com/HowProgrammingWorks/FactoryMethod) — chooses the correct abstraction to create an instance; in JavaScript, this can be implemented using `if`, `switch`, or selection from a collection (dictionary).
17
+
-[Prototype](https://github.com/HowProgrammingWorks/PrototypePattern) — creates objects by cloning a prepared instance to save resources (not to be confused with [Prototype-programming](https://github.com/HowProgrammingWorks/Prototype), which is closer to Flyweight).
18
+
-[Flyweight](https://github.com/HowProgrammingWorks/Flyweight) — saves memory allocation by sharing common state among multiple instances.
19
+
-[Singleton](https://github.com/HowProgrammingWorks/Singleton) — provides global access to a single instance; often considered an anti-pattern, easiest implemented via ESM/CJS module caching exported refs.
20
+
-[Object Pool](https://github.com/HowProgrammingWorks/Pool) — reuses pre-created objects to save resources during frequent creation and destruction.
-[Adapter](https://github.com/HowProgrammingWorks/Adapter) — converts an incompatible interface into a compatible one, enabling third-party component usage without altering its code; can even transform a function contract into an object or vice versa.
23
+
-[Wrapper](https://github.com/HowProgrammingWorks/Wrapper) — function wrapper that delegates calls and adds behavior; a specialized case of Adapter.
24
+
- Boxing — wraps primitives into object types to add methods or unify interfaces, e.g., narrowing `String` to `AddressString`.
25
+
- Decorator
26
+
-[Decorator](https://github.com/HowProgrammingWorks/Decorator) — dynamically extends behavior without inheritance, typically via composition and declarative syntax, effectively adding metadata.
27
+
-[Proxy](https://github.com/HowProgrammingWorks/Proxy) — controls access to an object by intercepting calls, reads, and writes; useful for lazy initialization, caching, and security; can be implemented via GoF or native JavaScript Proxy.
28
+
-[Bridge](https://github.com/HowProgrammingWorks/Bridge) — separates two or more abstraction hierarchies via composition or aggregation, allowing them to evolve independently.
29
+
-[Composite](https://github.com/HowProgrammingWorks/Composite) — implements a common interface to uniformly handle individual objects and their tree structures, e.g., DOM or file systems.
30
+
-[Facade](https://github.com/HowProgrammingWorks/Facade) — simplifies access to a complex system, providing a unified and clear interface, hiding and protecting internal complexity.
31
+
-[Flyweight](https://github.com/HowProgrammingWorks/Flyweight) — saves memory allocation by sharing common state among multiple instances.
27
32
- ⚡ Behavioral patterns
28
-
- Chain of responsibility
29
-
-[Chain of responsibility](https://github.com/HowProgrammingWorks/ChainOfResponsibility)
-[Chain of Responsibility](https://github.com/HowProgrammingWorks/ChainOfResponsibility) — passes control through a chain of handlers, selecting a responsible one; all handlers can read, but only one will modify.
34
+
-[Middleware](https://www.youtube.com/watch?v=RS8x73z4csI) — handler chain similar to CoR, but each can modify state and pass control to the next one, potentially leading to race conditions and conflicts.
35
+
36
+
-[Command](https://github.com/HowProgrammingWorks/Command) — encapsulates an action (execution request) and parameters into an object, allowing queuing, cancellation, repetition, etc.
37
+
-[Interpreter](https://github.com/HowProgrammingWorks/Interpreter) — implements a DSL language (Domain Specific Language) or parses expressions into AST (Abstract Syntax Tree) for interpretation.
38
+
-[Iterator](https://github.com/HowProgrammingWorks/Iterator) — sequentially traverses collections or streams element-by-element without exposing all data; JavaScript provides built-in Iterator and AsyncIterator.
39
+
-[Mediator](https://github.com/HowProgrammingWorks/Mediator) — optimizes communication between N components, centralizing interaction to reduce coupling from `N*(N-1)/2` down to `N`.
40
+
-[Memento](https://github.com/HowProgrammingWorks/Memento) — saves and restores snapshots of an object's state without direct access to its internal state.
41
+
-[Observable](https://github.com/HowProgrammingWorks/Observer) — notifies subscribers about changes to an object's state via Events:
42
+
-[EventEmitter](https://github.com/HowProgrammingWorks/EventEmitter) for Node.js: Observable + listener
43
+
-[EventTarget](https://github.com/HowProgrammingWorks/Events) for Web API: EventTarget + Event (CustomEvent) + listener
-[State](https://github.com/HowProgrammingWorks/State) — implements a Finite State Machine (FSM) where methods represent transitions, and state is composed into abstraction and switched during transitions.
46
+
-[Strategy](https://github.com/HowProgrammingWorks/Strategy) — selects interchangeable behavior at runtime from a collection of implementations: functions, objects, or classes
47
+
-[Template method](https://github.com/HowProgrammingWorks/TemplateMethod) — defines algorithm steps, allowing subclasses to override individual steps while defaulting to the superclass behavior.
48
+
-[Visitor](https://github.com/HowProgrammingWorks/Visitor) — adds operations to objects without altering their classes, separating structure and behavior into distinct abstractions.
49
+
-[Revealing Constructor](https://github.com/HowProgrammingWorks/RevealingConstructor) — changes behavior without inheritance, injecting functionality into constructors via functions or objects describing the behavior.
0 commit comments