Design Patterns Senior interview questions and answers
75 questions for a Design Patterns (Senior) interview - with correct answers, explanations and links to the docs.
Take this quiz- 1.How does the "signals" model (Solid, Preact Signals, Angular Signals) differ from React's model?
- 2.What's the main trade-off of micro-frontends?
- 3.Why is React declared as a
sharedsingleton in Module Federation? - 4.How does the Strangler Fig pattern work when migrating a legacy frontend?
- 5.What does CQRS mean?
- 6.What is Event Sourcing?
- 7.What is a Bounded Context in DDD?
- 8.What's the idea of hexagonal architecture (Ports & Adapters)?
- 9.When does Clean Architecture on the frontend become harmful?
- 10.How do you automatically enforce architectural import rules (e.g. FSD layers)?
- 11.What is an Anti-Corruption Layer?
- 12.How does an RxJS Observable differ from a Promise?
- 13.What do statecharts (XState) offer compared to a flat finite state machine?
- 14.What is the Backend for Frontend (BFF) pattern?
- 15.What is the expression problem, and how does it show up in TS?
- 16.What does "functional core, imperative shell" mean?
- 17.What is the "Hollywood principle", and how does it show up in React?
- 18.What is a Composition Root?
- 19.Why is Service Locator often considered an anti-pattern compared to DI?
- 20.What's wrong with a "God Context" - one React Context holding all of the app's state?
- 21.What is temporal coupling?
- 22.What does Conway's law state?
- 23.How does the MobX approach differ from Redux architecturally?
- 24.Why is separating "server" and "client" state considered an important architectural decision?
- 25.What is Islands Architecture?
- 26.What's the right way to evolve the public API of a shared component library?
- 27.What is an ADR (Architecture Decision Record)?
- 28.Why is the order of middleware or interceptors in a chain of responsibility risky?
- 29.What distinguishes a Value Object?
- 30.What is an Aggregate in DDD?
- 31.What does the Command-Query Separation (CQS) principle require?
- 32.What does the "Tell, Don't Ask" principle mean?
- 33.What does the Fail Fast principle mean?
- 34.What's the risk of Postel's law ("be liberal in what you accept")?
- 35.How should the UI account for eventual consistency in an event-driven system?
- 36.How does redux-saga differ from listener middleware and thunks?
- 37.Why is normalizing data in a frontend store an architectural pattern rather than a micro-optimization?
- 38.How do you use Strategy for A/B tests without cluttering components with conditions?
- 39.What are afferent and efferent coupling of a module?
- 40.How does a modular monolith differ from microservices (micro-frontends)?
- 41.What are domain events on the frontend, and why are they useful?
- 42.How does the Circuit Breaker pattern help the client when an API fails?
- 43.When is the Visitor pattern justified in a TypeScript project?
- 44.How do you implement reliable undo in a collaborative editor with several users editing?
- 45.What does a Facade over a third-party UI library (e.g. your own
<Button>on top of MUI) give you? - 46.What's the difference between "implementation inheritance" and "interface inheritance"?
- 47.Why is the Saga pattern (orchestration) in distributed processes relevant to the frontend?
- 48.How do Server Components change architecture compared to an SPA?
- 49.What is an "internal platform" (design system + shared packages), and when should you extract one?
- 50.What is the "second-system effect" in architectural decisions?
- 51.What problem does the Transactional Outbox pattern solve?
- 52.How does an API Gateway differ from a Backend for Frontend?
- 53.What is the core idea of the actor model?
- 54.Why distinguish release, experiment, ops and permission toggles?
- 55.How does an "event notification" differ from "event-carried state transfer"?
- 56.What characterizes a microkernel (plugin) architecture, as in VS Code?
- 57.What does "parse, don't validate" mean?
- 58.Two packages:
checkoutneeds to send emails, andnotificationsimplements email sending. Following DIP, who owns the interface? - 59.What does the Stable Dependencies Principle say?
- 60.Why does the Acyclic Dependencies Principle matter in a monorepo?
- 61.What is connascence?
- 62.What does the Law of Leaky Abstractions say?
- 63.What does Hyrum's Law imply for a widely used component library?
- 64.How does Chesterton's fence apply to refactoring legacy code?
- 65.What is the Bulkhead pattern?
- 66.How does the Cache-Aside pattern work?
- 67.What is a retry storm, and how is it prevented?
- 68.What do consumer-driven contract tests (e.g. Pact) give a frontend and backend?
- 69.What is an architectural fitness function?
- 70.How does trunk-based development relate to feature flags?
- 71.What is a key trade-off of a monorepo compared to many repositories?
- 72.How does saga orchestration differ from choreography?
- 73.What is a "distributed monolith"?
- 74.Why are Value Objects useful for money amounts on the frontend?
- 75.Why use queues to decouple a slow operation (e.g. generating a PDF report) from a user request?