SwadhyAI Notes
Low-Level Design Notes
Learn low-level design as its own subject: domain modeling, GRASP, SOLID, interview patterns, in-process concurrency, and Java machine-coding case studies.
Lessons
- What is LLD?
- HLD vs LLD
- LLD interview approach
- Requirements to classes
- Interview framework and rubric
- Domain modeling fundamentals
- Entity vs Value Object
- Identity, equality, and object comparison
- Common value objects
- Association, aggregation, composition
- Object ownership and lifecycle
- Designing collections inside domain objects
- Entity vs Service responsibilities
- Rich domain model vs anemic model
- Put behavior where the data lives
- Composition vs inheritance
- Encapsulation in object design
- Interfaces and contracts
- SOLID principles
- Single Responsibility
- Open-Closed
- Liskov Substitution
- Interface Segregation
- Dependency Inversion
- GRASP principles overview
- Information Expert
- Creator
- Controller
- Protected Variations
- Low coupling and high cohesion
- DRY, KISS, and YAGNI
- Law of Demeter
- Use cases and system operations
- Assigning responsibilities
- Object collaboration
- Sequence diagrams
- State machines
- Modeling object lifecycle
- Valid and invalid state transitions
- State machine vs status enum
- Finding changing parts of the design
- When to use a pattern
- Factory Method
- Abstract Factory
- Builder
- Prototype
- Singleton — and when not to
- Adapter
- Facade
- Adapter vs Facade
- Bridge
- Composite
- Decorator
- Flyweight
- Proxy
- Chain of Responsibility
- Command
- Interpreter
- Iterator
- Mediator
- Memento
- Observer
- State pattern
- Strategy
- Template Method
- Visitor
- Null Object
- Specification pattern
- Registry pattern
- Policy object
- Dependency injection
- Designing a class API
- Commands vs queries
- Evolving an API without breaking callers
- Collection API design
- Null, Optional, empty collections
- Request/response vs domain objects
- Errors and domain exceptions
- Validation at the boundary
- DTO vs domain model
- Idempotency in object APIs
- Keeping persistence out of the domain
- Repository abstraction
- Where transactions begin and end
- Domain model vs persistence model
- Race conditions in object design
- Atomicity and memory visibility
- Avoiding shared state
- Optimistic vs pessimistic concurrency
- Safely changing object state
- Thread-safe object design
- Immutability as a concurrency tool
- Locks and monitors
- Producer-consumer
- Executors and thread pools
- Concurrent collections
- Parking Lot
- Library Management
- Elevator System
- Splitwise
- Snake and Ladder
- Tic-Tac-Toe
- Chess
- ATM
- Vending Machine
- Movie Ticket Booking
- Ride matching (in-process)
- LRU Cache
- Rate limiter (in-process)
- Pub/Sub (in-process)
- Task Scheduler
- Logging Framework
- Notification Service
- In-memory file system
- In-memory key-value store
- URL shortener (machine coding)
- Meeting / Calendar Scheduler
- Inventory / Order System
- Rule Engine
- Designing for extension
- Testing an LLD design
- Designing code that is easy to test
- Stub, Fake, Mock
- Clock, randomness, UUIDs and tests
- Designing around dependencies
- Refactoring toward a better design
- Design smells
- From smells to patterns
- Package and class organization