HTML
GoF Design Patterns - HTML
GoF Design Patterns are 23 reusable solutions for object-oriented software design proposed in the 1994 book 'Design Patterns: Elements of Reusable Object-Oriented Software' by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (collectively known as the 'Gang of Four'). Divided into three categories—Creational, Structural, and Behavioral patterns—they are widely used to improve software reusability, maintainability, and scalability.
design patterns
GoF
object-oriented
software design
programming
<table>
<thead><tr><th>code</th><th>slug</th><th>name</th><th>description</th><th>category</th></tr></thead>
<tbody><tr><td>C01</td><td>factory-method</td><td>Factory Method</td><td>Defines an interface for creating objects, but lets subclasses decide which class to instantiate.</td><td>Creational Pattern</td></tr>
<tr><td>C02</td><td>abstract-factory</td><td>Abstract Factory</td><td>Provides an interface for creating families of related objects without specifying concrete classes.</td><td>Creational Pattern</td></tr>
<tr><td>C03</td><td>singleton</td><td>Singleton</td><td>Ensures a class has only one instance and provides a global point of access to it.</td><td>Creational Pattern</td></tr>
<tr><td>C04</td><td>prototype</td><td>Prototype</td><td>Creates new objects by copying existing ones.</td><td>Creational Pattern</td></tr>
<tr><td>C05</td><td>builder</td><td>Builder</td><td>Constructs complex objects step by step, separating construction from representation.</td><td>Creational Pattern</td></tr>
<tr><td>S01</td><td>adapter</td><td>Adapter</td><td>Allows incompatible interfaces to work together.</td><td>Structural Pattern</td></tr>
<tr><td>S02</td><td>bridge</td><td>Bridge</td><td>Separates abstraction from implementation, allowing both to vary independently.</td><td>Structural Pattern</td></tr>
<tr><td>S03</td><td>composite</td><td>Composite</td><td>Composes objects into tree structures to represent part-whole hierarchies.</td><td>Structural Pattern</td></tr>
<tr><td>S04</td><td>decorator</td><td>Decorator</td><td>Adds new functionality to objects dynamically without altering their structure.</td><td>Structural Pattern</td></tr>
<tr><td>S05</td><td>facade</td><td>Facade</td><td>Provides a simplified interface to a complex subsystem.</td><td>Structural Pattern</td></tr>
<tr><td>S06</td><td>flyweight</td><td>Flyweight</td><td>Reduces memory usage by sharing data among similar objects.</td><td>Structural Pattern</td></tr>
<tr><td>S07</td><td>proxy</td><td>Proxy</td><td>Provides a surrogate or placeholder for another object to control access to it.</td><td>Structural Pattern</td></tr>
<tr><td>B01</td><td>chain-of-responsibility</td><td>Chain of Responsibility</td><td>Passes requests along a chain of handlers until one handles it.</td><td>Behavioral Pattern</td></tr>
<tr><td>B02</td><td>command</td><td>Command</td><td>Encapsulates a request as an object, decoupling sender from receiver.</td><td>Behavioral Pattern</td></tr>
<tr><td>B03</td><td>interpreter</td><td>Interpreter</td><td>Defines a representation for a language's grammar and interprets sentences.</td><td>Behavioral Pattern</td></tr>
<tr><td>B04</td><td>iterator</td><td>Iterator</td><td>Provides a way to access elements of a collection sequentially.</td><td>Behavioral Pattern</td></tr>
<tr><td>B05</td><td>mediator</td><td>Mediator</td><td>Defines how objects interact through a mediator, reducing direct dependencies.</td><td>Behavioral Pattern</td></tr>
<tr><td>B06</td><td>memento</td><td>Memento</td><td>Captures and restores an object's internal state without violating encapsulation.</td><td>Behavioral Pattern</td></tr>
<tr><td>B07</td><td>observer</td><td>Observer</td><td>Notifies multiple observers automatically when subject's state changes.</td><td>Behavioral Pattern</td></tr>
<tr><td>B08</td><td>state</td><td>State</td><td>Allows an object to alter its behavior when its internal state changes.</td><td>Behavioral Pattern</td></tr>
<tr><td>B09</td><td>strategy</td><td>Strategy</td><td>Encapsulates algorithms and makes them interchangeable at runtime.</td><td>Behavioral Pattern</td></tr>
<tr><td>B10</td><td>template-method</td><td>Template Method</td><td>Defines the skeleton of an algorithm, deferring some steps to subclasses.</td><td>Behavioral Pattern</td></tr>
<tr><td>B11</td><td>visitor</td><td>Visitor</td><td>Adds new operations to objects without modifying their classes.</td><td>Behavioral Pattern</td></tr></tbody>
</table>