SOLID & Design Patterns
SOLID Principles & Design Patterns Quick Reference
SOLID Principles Overview
Principle
Description
Single Responsibility Principle (SRP)
❌ Violation
✅ Following SRP
Open/Closed Principle (OCP)
❌ Violation
✅ Following OCP
Real-World Example: Discount Calculator
Liskov Substitution Principle (LSP)
❌ Violation
✅ Following LSP
Real-World Example: Bird Hierarchy
Interface Segregation Principle (ISP)
❌ Violation
✅ Following ISP
Real-World Example: Printer Interfaces
Dependency Inversion Principle (DIP)
❌ Violation
✅ Following DIP
Real-World Example: Data Access
Design Patterns
Creational Patterns
Singleton Pattern
Implementation
Real-World Example: Logger
Factory Pattern
Simple Factory
Factory Method
Abstract Factory Pattern
Implementation
Builder Pattern
Implementation
Fluent Builder with Director
Prototype Pattern
Implementation
Structural Patterns
Adapter Pattern
Implementation
Decorator Pattern
Implementation
Facade Pattern
Implementation
Proxy Pattern
Virtual Proxy (Lazy Loading)
Protection Proxy
Behavioral Patterns
Strategy Pattern
Implementation
Real-World: Payment Processing
Observer Pattern
Implementation
Using C# Events
Command Pattern
Implementation
Template Method Pattern
Implementation
Quick Reference: When to Use Which Pattern
Creational Patterns
Pattern
Use When
Structural Patterns
Pattern
Use When
Behavioral Patterns
Pattern
Use When
Last updated