Design Patterns in One Sentence
The abstract class focuses on business logic, while its subclasses determine the implementation details.
2D factory method. Create different products of the same variant.
Create product part by part, usually in chain.
Provide a method to clone itself.
Always return the same instance.
Encapsulate an instance of old class, and provide new interface to the outside.
Different abstraction layer and different implementation layer can be mixed at will.
A tree where all nodes provide the same interface, the leaves do the job, and non-leaves aggregate the results of their own leaves.
Encapsulate an instance of a class, and provide the same interface to the outside.
Encapsulate complicated logic, and provide simple interface to the outside.
Create a new class for those memory-consuming, shared attributes, for which a factory is created for caching.
Encapsulate an instance of a class, provide the same interface to the outside, and manage the lifecycle of the internal instance.
Chain of Responsibility
Process an object through a chain, where each link can determine whether to continue or terminate processing.
Abstract a callback function as a class, and makes it fetch arguments - explicitly on initialization or on its own - every time the command is executed.
Encapsulate an instance of a class, and provide the iteration method of this instance.
Elements in a system send their interaction information to the mediator, and listen to its schedule, rather than directly interacting with each other.
Create snapshots of another class.
The object notifies all of its observers of its latest update.
Divide a class with volatile states into state and context, where the state executes all state-related operations and can modify the state on its own.
Abstract different strategies into classes, and let the business logic pick which one to use.
The template parent class implements a set of standard methods, while its subclasses overload methods according to their needs.
The visited class redirects request to the visitor, who extends the interface of the visited class.