Choosing patterns under interview pressure
Patterns are tools, not goals. The right process: (1) identify the axis of variation, (2) check if a simple interface suffices, (3) name the pattern only if it clarifies communication.
| Smell | Likely pattern | Simpler alternative |
|---|---|---|
switch on type growing | Strategy or Factory | Map of handlers if < 5 variants |
| Behavior stacks (logging + cache + auth) | Decorator | Middleware chain / interceptors |
| Complex object with 10+ fields | Builder | Constructor with required fields only |
| Object changes mode frequently | State | Enum + methods if ≤ 4 states |
| Notify many listeners on change | Observer | Callback list on one interface |
Common anti-patterns in LLD interviews
Pattern stacking — AbstractSingletonFactoryProxy before requirements are clear. Premature abstraction — interface per class when there's one implementation. Anemic domain model — entities are data bags, all logic in services (acceptable briefly, but note the trade-off). God class — one SystemManager owns everything. Copy-paste polymorphism — three classes with identical methods differing only in one line (extract Strategy).
The YAGNI handshake
Senior signal = naming what you'd defer: "I'll use a concrete TokenBucketLimiter today; if we add sliding window, I'll extract RateLimitAlgorithm then." Interviewers prefer honest scoping over speculative frameworks.
Interview recovery move
If you've over-patterned, pause: "Let me simplify — we only need one implementation today, so I'll collapse these three interfaces into a single PaymentService and extract when the second provider appears." Recovering gracefully scores well.
Senior-level signal
Practice the phrase: "I'd start with the simplest design that meets stated requirements, then isolate the first extension point behind an interface." If challenged, compare two designs in one sentence: "Strategy adds one interface and N classes; a switch is fine for two cases but breaks OCP at three."
Where this goes next
Running an LLD Round applies these principles to the full 45-minute interview flow — where patterns fit in the timeline and when to stop designing.
Further Reading
Practice Tasks (Optional)
Design or implement locally in any language — no autograding. Focus on class structure, extensibility, and being able to explain trade-offs out loud.
- Simplify an over-patterned design15m
Given: 'AbstractFactory creates AbstractSingletonProxyFactoryBean'. Propose the simplest design that still supports two product families. Practice saying 'I'd start simpler and add patterns only when requirements demand' out loud.