Table of Contents

Fail Fast (FF)

Variants and Alternative Names

Context

Principle Statement

A design is better when fails fast, i.e. as soon as an unrepairable erroneous condition is encountered.

Description

Check for erroneous conditions like wrong parameter values, unmet preconditions, violated invariants, etc. In case of methods this means that it checks for errors and reports them for example by means of throwing an exception.

Rationale

When a failure remains undetected, it propagates through the system ultimately causing other modules to fail. This results in in a more complicated fault removal. Furthermore undesired side effects like corrupted files may occur. A crashed program clearly communicates that there is a problem and is often a better situation than a misbehaving program.

Strategies

Caveats

FF reveals problems which are already present in the system. For a system with only a few problems, this is good as the remaining faults are identified and fixed more easily. But applying FF to a system that has many problems may decrease reliability further as problems which were hidden, show up, produce error messages and lead to system aborts.

See also section contrary principles.

Origin

Evidence

Relations to Other Principles

Generalizations

Specializations

Contrary Principles

Complementary Principles

Principle Collections

Examples

Description Status

Stub

Further Reading

Discussion

Discuss this wiki article and the principle on the corresponding talk page.

2)
Andrew Hund and David Thomas The Pragmatic Programmer, p. 120