Master Design Patterns in One Sentence: Quick Insights for Beginners and Pros
This article presents concise, one‑sentence summaries of common design patterns—Simple Factory, Factory Method, Abstract Factory, Builder, Prototype, Singleton, Adapter, Bridge, Composite, Facade, Flyweight, Decorator, and Proxy—offering quick insights for beginners to form an initial impression and for experienced developers to refresh their knowledge.
The idea of “One‑Sentence Design Patterns” originated when I taught a training class and, after each pattern, summarized it in a single sentence, using plain language rather than abstract definitions.
This article is not intended for deep study of design patterns, as it contains no code or pattern extensions.
Correct usage: 1. Beginners can get a rough impression before deep learning. 2. Those who have studied patterns can quickly review.
Simple Factory Pattern
Core idea: Separate the class creation process from the object usage process.
Implementation: Define a factory that returns different class instances based on parameters (usually a string). The product classes typically implement the same interface so that the factory‑produced objects can be handled uniformly.
Factory Method Pattern
Core idea: Build on simple factory by creating different classes through instantiating different factories.
Implementation: Abstract the factory, delegating the class creation to subclasses of the factory. Adding a new product only requires a new concrete factory, adhering to the Open/Closed Principle.
Abstract Factory Pattern
Core idea: Extend factory method so that a factory produces a family of related objects.
Implementation: In a concrete factory, implement methods to create different products, facilitating the production of a “product family”.
Builder Pattern
Core idea: Define a construction process, with concrete builders handling the details, allowing the same process to construct different instances.
Prototype Pattern
Core idea: Use the Object class’s clone method to quickly copy objects.
Singleton Pattern
Core idea: Let a class hold its sole instance as a static and private member variable, ensuring only one instance exists system‑wide.
Implementation: The class has a private constructor and a
public static getInstance()method that returns the unique instance.
Adapter Pattern
Core idea: Create an adapter class that possesses both the behavior of an existing class and the interface expected by the client.
Implementation:
Class adapter: The adapter class implements the desired interface and inherits from the existing class to acquire its behavior.
Object adapter: The adapter class implements the desired interface and holds an instance of the existing class, delegating calls to it.
Bridge Pattern
Core idea: Use composition or aggregation to separate abstraction from implementation, allowing each to vary independently.
Composite Pattern
Core idea: Let individual objects and compositions of objects share the same interface, enabling clients to treat them uniformly via recursive calls.
Facade Pattern
Core idea: Provide a simplified interface (the facade) that hides the complexities of underlying subsystem calls.
Flyweight Pattern
Core idea: Build an object pool to reuse objects that appear frequently throughout the system.
Decorator Pattern
Core idea: Decorators and the objects they wrap share the same interface; the decorator holds a reference to the wrapped object and adds new behavior.
Implementation: Both concrete components and decorated components implement the same interface; the decorator maintains a reference to a concrete component to delegate calls.
Proxy Pattern
Core idea: The proxy holds an instance of the real implementation and forwards operations to it.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITFLY8 Architecture Home
ITFLY8 Architecture Home - focused on architecture knowledge sharing and exchange, covering project management and product design. Includes large-scale distributed website architecture (high performance, high availability, caching, message queues...), design patterns, architecture patterns, big data, project management (SCRUM, PMP, Prince2), product design, and more.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
