0PricingLogin
Erlang OTP: Distributed & Fault-Tolerant Systems Programming · Lesson

Designing for Crash-First

Embrace the 'crash-first' principle to design self-healing systems, where failures are expected and handled by supervisors.

Embrace the Crash-First Philosophy

In Erlang, we don't just handle errors; we embrace them! This is the "crash-first" principle.

Instead of trying to prevent every possible error with complex checks, Erlang systems are designed to let processes crash when something unexpected happens.

The system then relies on another component, the supervisor, to detect the crash and restart the failed process, ensuring continuous operation.

This approach leads to more robust, self-healing applications.

Defensive vs. Crash-First

Many programming paradigms emphasize "defensive programming":

  • Extensive input validation.
  • Complex error codes and handling logic.
  • Trying to recover *within* the failing function.

Crash-first flips this: If a process encounters an unrecoverable error, it should just crash. Let a higher-level entity (the supervisor) deal with the recovery.

All lessons in this course

  1. Links and Monitors Explained
  2. Robust Error Handling
  3. Designing for Crash-First
  4. The Let-It-Crash Philosophy
← Back to Erlang OTP: Distributed & Fault-Tolerant Systems Programming