Fail-fast system

In systems design, a fail-fast system is one that immediately reports at its interface any condition that is likely to indicate a failure. Fail-fast systems are usually designed to stop normal operation rather than attempt to continue a possibly flawed process. Such designs often check the system's state at several points in an operation, so that any failures can be detected early. The responsibility of a fail-fast module is detecting errors, and then letting the next-highest level of the system handle them.

Hardware and software

Fail-fast systems or modules are desirable in several circumstances:

Developers also refer to code as fail-fast if it tries to fail as soon as possible at a variable or object initialization. In object-oriented programming, a fail-fast-designed object initializes the internal state of the object in the constructor, launching an exception if something is wrong (rather than allowing non-initialized or partially initialized objects that will fail later due to a wrong "setter"). The object can then be made immutable if no more changes to the internal state are expected. In functions, fail-fast code will check input parameters in the precondition. In client-server architectures, fail-fast will check the client request just upon arrival, before processing or redirecting it to other internal components, returning an error if the request fails (incorrect parameters, ...). Fail-fast-designed code decreases the internal software entropy and reduces debugging effort.

Examples

  • A fail-fast application/system checks that all input/output resources needed for future computations are ready before any computation request arrives.
  • A fail-fast application/system checks that all immutable initial configurations are correct at startup.
  • A fail-fast function is a function that checks all input to the function in a precondition before proceeding with any computation or business logic in such function.
  • A fail-fast function will normally throw a runtime exception when some abnormal computation is found, making the system fail if no "catch" has been contemplated by any other, versus returning some error value without making any (optimistic) assumption about the correct management of the raised error.
  • From the field of software engineering, a fail-fast iterator is an iterator that attempts to raise an error if the sequence of elements processed by the iterator is changed during iteration.
  • Given an initial state in a state machine, a fail-fast system will check such a state and fail fast.
  • Given a state-change in a state machine, the fail-fast system will halt the machine if the state-change is forbidden. It could be the case that the forbidden state-change is due to a wrong external input. In that case, the fail-fast system will stop processing the request as soon as the wrong input is detected (vs. delegating to the state-machine implementation).

Business

The term has been widely employed as a metaphor in business, dating back to at least 2001, meaning that businesses should undertake bold experiments to determine the long-term viability of a product or strategy, rather than proceeding cautiously and investing years in a doomed approach. It became adopted as a kind of "mantra" within startup culture, i.e. "Fail fast, fail often."

See also

References

  1. ↑ Khanna, Rajat; Guler, Isin; Nerkar, Atul (2016-04-01). "Fail Often, Fail Big, and Fail Fast? Learning from Small Failures and R&D Performance in the Pharmaceutical Industry". Academy of Management Journal. 59 (2): 436–459. doi:10.5465/amj.2013.1109. ISSN 0001-4273.
  2. ↑ Surowiecki, James. "Epic Fails of the Startup World". The New Yorker. Retrieved 2017-08-14.