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
- Links and Monitors Explained
- Robust Error Handling
- Designing for Crash-First
- The Let-It-Crash Philosophy