Skip to content

Design Patterns & SOLID

A beginner-friendly guide to design patterns — reusable solutions to common software problems. Learn the Gang of Four patterns, SOLID principles, and when to apply them.

flowchart TB
Start[Start Here 🚀] --> Fundamentals[01. Fundamentals<br/>What & Why, OOP Refresher]
Fundamentals --> SOLID[02. SOLID Principles<br/>S O L I D]
SOLID --> Creational[03. Creational Patterns<br/>Object Creation]
Creational --> Structural[04. Structural Patterns<br/>Object Composition]
Structural --> Behavioral[05. Behavioral Patterns<br/>Object Interaction]
Behavioral --> Practical[06. Practical Guide<br/>When to Use What]
Practical --> Interview[07. Interview Prep<br/>Common Q&A]
style Start fill:#7c3aed,color:#fff
style Fundamentals fill:#3b82f6,color:#fff
style SOLID fill:#059669,color:#fff
style Creational fill:#06b6d4,color:#fff
style Structural fill:#f59e0b,color:#fff
style Behavioral fill:#ef4444,color:#fff
style Practical fill:#8b5cf6,color:#fff
style Interview fill:#ec4899,color:#fff
flowchart LR
subgraph Creational["🏗️ Creational"]
S1[Singleton]:::c
F1[Factory Method]:::c
AF[Abstract Factory]:::c
B1[Builder]:::c
P1[Prototype]:::c
end
subgraph Structural["🔧 Structural"]
Ad[Adapter]:::s
Dec[Decorator]:::s
Fac[Facade]:::s
Pr[Proxy]:::s
Com[Composite]:::s
end
subgraph Behavioral["🔄 Behavioral"]
Ob[Observer]:::b
St[Strategy]:::b
Cmd[Command]:::b
It[Iterator]:::b
Sta[State]:::b
end
classDef c fill:#06b6d4,color:#fff
classDef s fill:#f59e0b,color:#fff
classDef b fill:#ef4444,color:#fff
PatternCategoryPurpose
SingletonCreationalOne global instance
Factory MethodCreationalDelegate object creation to subclasses
Abstract FactoryCreationalFamilies of related objects
BuilderCreationalStep-by-step object construction
PrototypeCreationalClone existing objects
AdapterStructuralMake incompatible interfaces work together
DecoratorStructuralAdd behavior without changing the class
FacadeStructuralSimplified interface to a complex system
ProxyStructuralControl access to another object
CompositeStructuralTreat individual & group objects uniformly
BridgeStructuralSeparate abstraction from implementation
FlyweightStructuralShare data to save memory
ObserverBehavioralOne-to-many notifications
StrategyBehavioralSwap algorithms at runtime
CommandBehavioralEncapsulate requests as objects
IteratorBehavioralTraverse collections without exposing internals
StateBehavioralChange behavior when state changes
Template MethodBehavioralDefine skeleton, let subclasses fill details
Chain of ResponsibilityBehavioralPass request along a chain of handlers
MediatorBehavioralCentralize communication between objects
MementoBehavioralSave & restore object state
VisitorBehavioralAdd operations without changing classes