Week 13 — HLD Reliability & SOLID

intermediate hld lld dsa

Goal: Understand distributed system tradeoffs (CAP, consistency, failover) and master the SOLID principles — the design vocabulary every interviewer expects you to speak fluently.

Topics

DayFocusTopics
MonHLD ReliabilityCAP Theorem · Consistency Models · Failover and Redundancy
TueHLD CommunicationREST API Design · WebSockets · Polling, Long Polling, SSE
WedHLD Ops & ProtectionMonitoring, Logging, Alerting · Rate Limiting
ThuSOLID Principles (Part 1)Single Responsibility Principle · Open/Closed Principle · Liskov Substitution Principle
FriSOLID Principles (Part 2) & DPInterface Segregation Principle · Dependency Inversion Principle · 1D DP Patterns

Key Concepts

  • CAP theorem real-world examples — classify systems as CP (MongoDB, HBase) vs AP (Cassandra, DynamoDB)
  • Strong vs eventual consistency — when each is acceptable and the spectrum in between
  • Active-passive vs active-active failover — tradeoffs in cost, complexity, and recovery time
  • REST best practices — idempotency, proper status codes (2xx/4xx/5xx), resource naming, HATEOAS
  • WebSocket vs SSE vs polling — pick the right tool: bidirectional (WebSocket), server-push (SSE), simple (polling)
  • Each SOLID principle with code violations and fixes — learn to spot and refactor anti-patterns
  • SRP: one reason to change. OCP: extend without modifying. LSP: subtypes must be substitutable
  • ISP: no client should depend on methods it doesn’t use. DIP: depend on abstractions, not concretions
  • 1D DP patterns — climbing stairs, house robber, decode ways, coin change variations

Practice

  • Classify 5 real databases as CP or AP and justify your reasoning
  • Design a RESTful API for a bookstore — define resources, endpoints, status codes, and error responses
  • Refactor a God class that handles user auth, email sending, and logging into SRP-compliant classes
  • Solve the house robber problem using both top-down and bottom-up DP

~14 topics · ~1.5-2 hrs/day · Focus: read the linked notes, then code each concept