<Creational Patterns>
- Singleton
- Factory Method
- Abstract Factory
- Builder
- Prototype
- Object Pool
</Creational Patterns>
<Structural Patterns>
- Adapter
- Decorator
- Facade
- Composite
- Bridge
- Flyweight
- Proxy
</Structural Patterns>
<Behavioral Patterns>
- Observer
- Strategy
- Command
- Template Method
- State
- Chain of Responsibility
- Visitor
- Mediator
- Iterator
- Memento
</Behavioral Patterns>
<Concurrency Patterns>
- Thread Pool
- Producer-Consumer
- Read-Write Lock
- Monitor Object
- Active Object
- Future/Promise
</Concurrency Patterns>
<Architectural Patterns>
- Model-View-Controller (MVC)
- Model-View-Presenter (MVP)
- Model-View-ViewModel (MVVM)
- Repository
- Unit of Work
- Dependency Injection
- Service Locator
- Layered Architecture
</Architectural Patterns>
<Enterprise Integration Patterns>
- Message Queue
- Publish-Subscribe
- Request-Reply
- Message Router
- Content Filter
- Message Translator
</Enterprise Integration Patterns>
<Database Patterns>
- Active Record
- Data Mapper
- Table Data Gateway
- Row Data Gateway
- Identity Map
- Lazy Loading
</Database Patterns>
Here are the essential software design patterns you should know for system design interviews:
Creational Patterns
Singleton - Ensure only one instance of a class exists globally. Common in database connections, logging, and configuration management. Be aware of thread safety issues and alternatives like dependency injection.
Factory Method - Create objects without specifying exact classes. Useful for creating different types of database connections, payment processors, or notification services based on configuration.
Abstract Factory - Create families of related objects. Examples include creating different UI components for different operating systems or different cloud service providers (AWS vs Azure vs GCP).
Builder - Construct complex objects step by step. Essential for creating configuration objects, SQL queries, or API requests with many optional parameters.
Prototype - Create objects by cloning existing instances. Useful for creating default configurations or when object creation is expensive.
Structural Patterns
Adapter - Allow incompatible interfaces to work together. Common when integrating third-party libraries or legacy systems with different APIs.
Facade - Provide a simplified interface to complex subsystems. Examples include API gateways that hide multiple microservices behind a single endpoint.
Decorator - Add behavior to objects dynamically without altering structure. Used in middleware chains, authentication layers, and feature toggles.
Proxy - Provide a placeholder/surrogate for another object to control access. Examples include caching proxies, security proxies, and lazy loading.
Composite - Treat individual objects and compositions uniformly. Useful for tree structures like file systems, organization hierarchies, or UI components.
Behavioral Patterns
Observer - Define one-to-many dependency between objects. Essential for event-driven architectures, pub-sub systems, and real-time notifications.
Strategy - Encapsulate algorithms and make them interchangeable. Examples include different sorting algorithms, payment methods, or pricing strategies.
Command - Encapsulate requests as objects. Used in undo/redo functionality, queuing operations, and macro recording.
State - Allow objects to alter behavior when internal state changes. Common in state machines, workflow engines, and game development.
Template Method - Define algorithm skeleton in base class, let subclasses override specific steps. Used in frameworks and data processing pipelines.
Chain of Responsibility - Pass requests along a chain of handlers. Examples include middleware processing, validation chains, and approval workflows.
Most Critical for Interviews
Focus especially on Singleton, Factory, Builder, Observer, Strategy, and Facade as these appear most frequently in system design discussions.
Understand not just
- how to implement them,
- but when and why to use each pattern,
- their trade-offs, and
- real-world applications in distributed systems.
Excalidraw Data
Text Elements
Design Patterns
-
Thread Pool
-
Producer-Consumer
-
Read-Write Lock
-
Monitor Object
-
Active Object
-
Future/Promise
</Concurrency Patterns>
-
Model-View-Controller (MVC)
-
Model-View-Presenter (MVP)
-
Model-View-ViewModel (MVVM)
-
Repository
-
Unit of Work
-
Dependency Injection
-
Service Locator
-
Layered Architecture
</Architectural Patterns>
-
Message Queue
-
Publish-Subscribe
-
Request-Reply
-
Message Router
-
Content Filter
-
Message Translator
</Enterprise Integration Patterns>
-
Active Record
-
Data Mapper
-
Table Data Gateway
-
Row Data Gateway
-
Identity Map
-
Lazy Loading
</Database Patterns>
Creational Patterns
Singleton
Factory Method
Abstract Factory
Builder
Prototype
Object Pool
Structural Patterns
Adapter
Decorator
Facade
Composite
Bridge
Flyweight
Proxy
Observer
Strategy
Structural Patterns
Command
Template Method
State
Chains of Responsibility
Visitor
Mediator
Iterator
Memento