Pattern Design Architectural and Enterprise Patterns 3 — Questions and Answers
Question 1: The Bulkhead pattern in distributed systems is analogous to:
- Watertight compartments in a ship that prevent one leak from sinking the whole vessel (Correct answer)
- A circuit breaker that stops cascading failures
- A reverse proxy that balances load
- A saga that compensates for failed transactions
Correct answer: Watertight compartments in a ship that prevent one leak from sinking the whole vessel
The Bulkhead pattern isolates elements of an application into pools so that if one fails, the others continue to function.
Question 2: The Circuit Breaker pattern helps prevent:
- Cascading failures when a downstream service is unavailable (Correct answer)
- Duplicate message processing in queues
- Race conditions in multithreaded code
- Stale data in read models
Correct answer: Cascading failures when a downstream service is unavailable
The Circuit Breaker monitors calls to an external service and stops sending requests when failures exceed a threshold, giving the service time to recover.
Question 3: In Domain-Driven Design, an Aggregate is:
- A cluster of domain objects treated as a single unit for data changes (Correct answer)
- A service that orchestrates domain logic
- A query object for reading domain state
- A repository for multiple entity types
Correct answer: A cluster of domain objects treated as a single unit for data changes
An Aggregate is a boundary around a group of domain objects that ensures consistency — all changes go through the Aggregate Root.
Question 4: The Backend for Frontend (BFF) pattern creates:
- A dedicated API layer tailored for each specific frontend client (Correct answer)
- A shared API gateway for all clients
- A proxy that caches responses for mobile devices
- A service mesh for microservice communication
Correct answer: A dedicated API layer tailored for each specific frontend client
BFF creates separate backend services optimized for each frontend (e.g., web BFF, mobile BFF), avoiding a one-size-fits-all API.
Question 5: Eventual consistency in distributed systems means:
- All nodes will reach the same state given enough time and no new updates (Correct answer)
- All nodes are always in sync in real time
- Reads always reflect the most recent write
- Transactions always span all nodes simultaneously
Correct answer: All nodes will reach the same state given enough time and no new updates
Eventual consistency guarantees that, in the absence of new updates, all replicas will converge to the same value, trading immediate consistency for higher availability.
Question 6: Which pattern is commonly used to handle retries and idempotency for failed distributed transactions?
- Idempotent Consumer (Correct answer)
- Bulkhead
- Anti-Corruption Layer
- Strangler Fig
Correct answer: Idempotent Consumer
The Idempotent Consumer pattern ensures that processing a message multiple times (due to retries) has the same effect as processing it once.
The Bulkhead pattern in distributed systems is analogous to: