intermediate 2 min answer

An architect faces a problem that resembles a known pattern but does not quite fit. How should first-principles reasoning and pattern recognition be combined?

zeptofirst-principlespatternsjudgementanalogy
Show the full answer Hide the answer

What each gives and costs

Pattern recognition is fast and usually right. Most problems are instances of something solved before, and reaching for the known solution saves enormous time. Its failure mode is applying a pattern whose preconditions do not hold, which is invisible because the pattern's shape fits and its assumptions do not.

First-principles reasoning is slow and occasionally reveals a much better answer. Its failure mode is re-deriving something well known, badly, at great cost.

How to combine them

Use the pattern to generate the candidate and first principles to check its preconditions.

Every pattern encodes assumptions. A saga assumes compensations exist. Optimistic concurrency assumes conflicts are rare. Caching assumes read-heavy access with tolerable staleness. Sharding assumes a key that distributes and matches the invariants. The check is: do this problem's conditions match the pattern's assumptions?

Where they diverge is exactly where the pattern will fail, and identifying the divergence is usually a ten-minute exercise that prevents a quarter of rework.

The quick-commerce example

A ten-minute delivery promise resembles a standard order-fulfilment problem and differs in one assumption: the physical world does not roll back. A dispatched rider is a cost incurred; a picked item is stock committed. Compensation is a refund or a wasted trip rather than a database operation.

That single divergence changes the design: strong consistency at the point of commitment, reversible steps ordered before irreversible ones, and safety stock rather than exact counts — none of which the standard pattern would have suggested.

When to go to first principles fully

When the pattern's assumptions are violated in a way that matters, and when the cost of being wrong is high. Both conditions, not one. A violated assumption on a cheap reversible decision does not justify a derivation from scratch.

The failure to avoid in both directions

Cargo-culting — applying a pattern because it is well regarded, without checking preconditions. And contrarianism — rejecting established solutions to derive a novel one, which is usually slower and worse and is frequently motivated by interest rather than by the problem.