Design Patterns & Concurrency for LLD
The thirteen patterns that actually appear in LLD and machine-coding rounds, each with when to use it, idiomatic TypeScript and the trap interviewers set, plus how to make an in-memory design safe under concurrency, from one event loop to worker_threads to many pods.
About 130 minutes · 18 exam questions · 14 interview questions · 2 code labs
What you will learn
- How patterns are scored in an LLD round: smell first, pattern second
- Strategy and Factory / Abstract Factory: replacing the type switch
- Builder, and Singleton (and why DI beats it)
- Observer / pub-sub: decoupling side effects without losing them
- State: making illegal transitions impossible
- Command: undo, redo and idempotent actions
- Decorator, Adapter, Facade (and Proxy): four wrappers, four intents
- Chain of Responsibility and Template Method: ordered steps, two ways
- Repository with optimistic versioning: the machine-coding storage seam
- Anti-patterns: god class, anaemic model, over-patterning
- Races in in-memory stores: async-mutex, lock granularity and lock ordering
- Producer–consumer with a bounded queue: backpressure in one process
- Thread-safe singletons and lazy initialisation (the Java questions, and Node's version)
- Event loop vs worker_threads vs multiple pods: when an in-process lock stops being enough
Previous: OOP, SOLID & Modelling for LLD · Next: LRU Cache: Implementation & The Follow-up Ladder