The Let-It-Crash Philosophy
Understand Erlang's let-it-crash mindset and how isolating errors, restarting cleanly, and avoiding defensive coding produce more reliable systems.
The Let-It-Crash Philosophy is a free Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Erlang OTP: Distributed & Fault-Tolerant Systems Programming learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
A Different Mindset
Most languages encourage catching every possible error. Erlang takes the opposite view: let it crash. A process that hits an unexpected state should die and be restarted into a known-good state.
Why Crashing Is Good
A crash is a clean, well-defined failure. Trying to limp along in a corrupted state often causes worse, harder-to-debug problems later.
Process Isolation
Erlang processes share nothing. One crashing process cannot corrupt another's memory, so a failure stays contained.
Happy-Path Code
Because supervisors handle failures, you write only the success case. No tangle of defensive checks.
handle(Request) ->
{ok, Data} = fetch(Request), % crashes if not ok
process(Data).Assertive Matching
The match {ok, Data} = fetch(...) doubles as an assertion: if fetch returns anything else, the process crashes immediately rather than continuing with bad data.
Supervisors Do the Recovery
A supervisor (covered earlier) watches workers and restarts them per its strategy. Let-it-crash works because supervision provides recovery.
Separating Logic from Errors
Keep risky operations in worker processes that may crash, while a stable supervisor process holds the recovery policy. This separation keeps both simple.
When NOT to Crash
Expected, recoverable conditions (a user typing a bad value) are not exceptional. Handle those normally; crash only on truly unexpected states.
case validate(Input) of
ok -> save(Input);
{error, Reason} -> {error, Reason}
end.Errors vs Exits
A runtime error (like a failed match) crashes the process with reason {badmatch, ...}. You can also crash deliberately with exit/1 to signal an unrecoverable problem.
exit(disk_full).Crash Reports & Logging
When a process dies, OTP logs a crash report with the reason and stack. SASL and logger capture these so failures are observable even though you did not catch them.
The Payoff
Let-it-crash plus supervision yields systems that self-heal from transient faults and stay running for years. Code is smaller, clearer, and focused on the real work.
Quick Check
Test your understanding of the philosophy.
Recap
You learned the let-it-crash philosophy.
- Crash on unexpected state instead of coding defensively
- Process isolation contains failures
- Supervisors provide recovery
- Still handle expected, recoverable cases normally
Frequently asked questions
Is the “The Let-It-Crash Philosophy” lesson free?
Yes — the full text of “The Let-It-Crash Philosophy” is free to read here on the web, and the Erlang OTP: Distributed & Fault-Tolerant Systems Programming course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Erlang OTP: Distributed & Fault-Tolerant Systems Programming course, upgrade to CoddyKit PRO.
What will I learn in “The Let-It-Crash Philosophy”?
Understand Erlang's let-it-crash mindset and how isolating errors, restarting cleanly, and avoiding defensive coding produce more reliable systems. You practise Erlang OTP: Distributed & Fault-Tolerant Systems Programming with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Erlang OTP: Distributed & Fault-Tolerant Systems Programming?
No prior experience is required. Erlang OTP: Distributed & Fault-Tolerant Systems Programming on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “The Let-It-Crash Philosophy” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson?
Yes. Every Erlang OTP: Distributed & Fault-Tolerant Systems Programming lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Links and Monitors Explained
- Robust Error Handling
- Designing for Crash-First
- The Let-It-Crash Philosophy