🏛️ System Design Interview Questions
SOLID principles, design patterns, microservices architecture, and API design best practices
15-Minute Design Patterns Cheatsheet
Quick reference for last-minute interview preparation
🏛️ SOLID Principles
🔨 Creational Patterns
🏗️ Structural Patterns
🔄 Behavioral Patterns
🌐 Architecture Patterns
🔌 API Design
🔷 Microservices Patterns
⚠️ Common Interview Questions
SOLID Principles
Explain SOLID principles with real-world examples
HardSOLID is an acronym for five design principles that make software more maintainable, scalable, and flexible.
1. Single Responsibility Principle (SRP)
A class should have only one reason to change - it should have only one job or responsibility.
2. Open/Closed Principle (OCP)
Software entities should be open for extension but closed for modification.
3. Liskov Substitution Principle (LSP)
Objects of a superclass should be replaceable with objects of a subclass without breaking the application.
4. Interface Segregation Principle (ISP)
Clients should not be forced to depend on interfaces they don't use.
5. Dependency Inversion Principle (DIP)
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Microservices Architecture
Explain common microservices design patterns
HardMicroservices architecture requires specific patterns to handle distributed systems challenges.
1. API Gateway Pattern
Single entry point for all clients. Routes requests to appropriate microservices.
2. Circuit Breaker Pattern
Prevents cascading failures by stopping requests to failing services.
3. Saga Pattern (Distributed Transactions)
Manages data consistency across microservices through a sequence of local transactions.
4. Service Discovery Pattern
Automatically detect network locations of service instances.
5. CQRS Pattern (Command Query Responsibility Segregation)
Separate read and write operations for better scalability and performance.
Design Patterns (GoF)
Explain common design patterns (Singleton, Factory, Observer, Strategy)
Medium1. Singleton Pattern
Ensures a class has only one instance and provides a global point of access.
2. Factory Pattern
Creates objects without specifying the exact class to create.
3. Observer Pattern
Defines a one-to-many dependency so that when one object changes state, all dependents are notified.
4. Strategy Pattern
Defines a family of algorithms, encapsulates each one, and makes them interchangeable.
API Design
Explain REST API design best practices and common patterns
MediumRESTful API design follows specific conventions and best practices for building maintainable, scalable APIs.
1. Resource Naming Conventions
2. HTTP Status Codes
3. Versioning Strategies
4. Pagination, Filtering, and Sorting
5. Error Handling Pattern
Explain the difference between Monolithic and Microservices architecture
MediumMonolithic Architecture
All components of the application are tightly coupled and deployed as a single unit.
- Pros:
- Simple to develop and test initially
- Easy to deploy (single deployment unit)
- Better performance (no network calls between components)
- Easier debugging and tracing
- Simpler transaction management
- Cons:
- Difficult to scale specific features
- Large codebase becomes hard to maintain
- Slow deployment (must redeploy entire app)
- Technology stack locked in
- Single point of failure
Microservices Architecture
Application is decomposed into small, independent services that communicate over network.
- Pros:
- Independent scaling of services
- Technology diversity (different tech stack per service)
- Faster deployment (deploy only changed services)
- Better fault isolation
- Easier to understand smaller codebases
- Team independence
- Cons:
- Increased complexity (distributed systems)
- Network latency and failures
- Difficult to test end-to-end
- Data consistency challenges
- More operational overhead (multiple deployments)
- Debugging is harder
Explain Database Design Patterns and Normalization
MediumDatabase Normalization Forms
Normalization organizes data to reduce redundancy and improve data integrity.
Common Database Design Patterns
Interview Tips for Design Patterns & Architecture
- ✓ Know all SOLID principles and be ready to explain each with examples
- ✓ Understand when to use each creational pattern (Singleton, Factory, Builder)
- ✓ Be able to draw and explain microservices patterns (API Gateway, Circuit Breaker, Saga)
- ✓ Know the trade-offs between Monolithic and Microservices architectures
- ✓ Understand REST API best practices: resource naming, status codes, versioning
- ✓ Practice system design questions: URL shortener, rate limiter, chat system
- ✓ Know database patterns: normalization, denormalization, soft delete, audit trails
- ✓ Understand CQRS and Event Sourcing for complex domains