liveBook · Manning

Fallback

As explained in Grokking Software Architecture

Fallback logic provides an alternative behavior when a preferred operation or dependency fails.

When the kitchen runs out of steak, a good waiter offers chicken instead of disappearing. A fallback is software’s Plan B: a pre-programmed alternative response when the preferred operation fails. It does not repair the broken dependency, but it can keep the experience moving and save a transaction. section 10.2 section 10.2.3

A fallback might return default data, use a cached response, or apply a simpler business rule. The result is often less tailored or less precise than the preferred one, so the choice should reflect what the business can afford to trade away. section 10.2.3

Save the sale

If a live shipping calculator is unavailable, an online store could charge a flat $5 shipping fee instead. The store might lose money on postage, but it can still complete a $100 sale. Similarly, a streaming homepage could show a fixed list of popular titles when personalized recommendations are unavailable. section 10.2.3

Fallbacks work alongside other resilience patterns. A timeout limits waiting; retries with exponential backoff give a failing request another chance. If those attempts fail, the fallback offers an alternative. A circuit breaker can also trigger a fallback when it opens, blocking calls to a failing dependency rather than making customers wait for each one to fail. section 10.2.3 section 10.3

Payment service outage

If a payment service is down, checkout can capture order data for later processing rather than simply throwing an error. The design must also decide what to show the customer while the order waits. A background queue is one possible Plan B; it changes when the charge happens rather than pretending the real-time payment succeeded. section 10.8 section 10.4.1

A backup is not automatically a useful fallback. On Ariane 5, the backup computer ran the same software as the primary and failed on the same calculation. A fallback needs a meaningfully different way forward, such as returning cached data, rather than repeating the same failure. section 10.7.2

Not every failure can be hidden. In a microservice aggregator, one service may fail while others still work, requiring explicit fallback logic for partial failures. The core post data, however, is required in the illustrated example, so its failure aborts the operation. section 12.7.2

How Grokking Software Architecture covers it

How deep it goes
Defines fallback responses and their business tradeoffs, then asks readers to design a payment-outage fallback.
Examples
Illustrates flat-rate shipping, fixed recommendations, queued orders, and an identical backup computer that fails alongside the primary.
What you can do after
Evaluate/understand it by choosing a defensible alternative that preserves customer progress while accepting an explicit business tradeoff.
How it connects
Connects fallbacks to timeouts, retries, exponential backoff, circuit breakers, caching, and partial failures.

Also explained in

Compare how 24 books explain fallback →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.