Whetstone
0day streak

Architecture Patterns

Named patterns interviewers probe by name.

10

Questions

4/2/4

Easy / Med / Hard

Your accuracy

A handful of patterns come up by name often enough that recognising them is worth more than deriving them on the spot.

CQRS separates the write model from the read model, so each can be shaped and scaled for its own job. It shines when reads and writes have wildly different volumes or shapes. It costs you a synchronisation path and the eventual consistency that comes with it, so applying it everywhere is a common over-correction.

Event sourcing stores the sequence of changes rather than current state, and derives state by replaying them. You get a complete audit trail and the ability to reconstruct any past state, and you take on schema evolution for events that live forever, plus snapshots so replay does not get slower every year. It pairs naturally with CQRS but does not require it.

Materialised view precomputes an expensive query into a table you can read cheaply. It is the database's own version of caching, with the same bargain: fast reads, in exchange for owning the refresh.

Strangler fig replaces a legacy system incrementally by routing slices of traffic to the new implementation until nothing reaches the old one. It is the pattern that makes big rewrites survivable, because every step is small and reversible.

Sidecar runs supporting behaviour — proxying, telemetry, secret rotation — in a process alongside the service rather than inside it, so it can be updated independently and shared across services in different languages.

Backend for frontend gives each client type its own tailored API layer, so a mobile app is not forced to consume a shape designed for a desktop web app.

Anti-corruption layer translates between your model and an external or legacy one, so their design decisions do not leak into yours.

Leader election picks one node to perform work that must happen exactly once across a cluster, such as running a scheduled job.

The failure mode is reaching for these early. Each one removes a problem you can name and adds a moving part you now operate. If you cannot say which specific pain a pattern takes away from the system in front of you, you are paying its cost and deferring its benefit — which is how an architecture ends up with five patterns and the original problem.