principles:fail_fast
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
principles:fail_fast [2013-01-15 11:15] – pragprog christian | principles:fail_fast [2013-05-19 22:09] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Variants and Alternative Names ===== | ===== Variants and Alternative Names ===== | ||
- | * Rule of Repair | + | * Rule of Repair((Eric S. Raymond: // |
+ | * Crash Early((Andrew Hund and David Thomas // | ||
===== Context ===== | ===== Context ===== | ||
/* fill in contexts here: */ | /* fill in contexts here: */ | ||
- | * [[contexts:Object-Oriented | + | * [[contexts:Implementation]] /* FF is more about implementation than design */ |
+ | * [[contexts: | ||
===== Principle Statement ===== | ===== Principle Statement ===== | ||
- | > Repair what you can — but when you must fail, fail noisily and as soon as possible.((Eric S. Raymond: // | + | A design is better |
===== Description ===== | ===== Description ===== | ||
+ | Check for erroneous conditions like wrong parameter values, unmet preconditions, | ||
===== Rationale ===== | ===== Rationale ===== | ||
+ | Then 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 ===== | ===== Strategies ===== | ||
+ | |||
+ | * Check input parameters for validity -- especially non-nullness. | ||
+ | * Throw an Exception. | ||
+ | * Use assertions. | ||
+ | |||
+ | |||
+ | ===== 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]]. | ||
Line 49: | Line 64: | ||
==== Complementary Principles ==== | ==== Complementary Principles ==== | ||
- | * [[principles:Postel' | + | * [[Postel' |
- | * [[principles: | + | * [[Principle |
+ | * [[Murphy' | ||
==== Principle Collections ==== | ==== Principle Collections ==== | ||
Line 57: | Line 73: | ||
{{page> | {{page> | ||
- | ===== Example | + | ===== Examples |
Line 69: | Line 85: | ||
* Eric S. Raymond: // | * Eric S. Raymond: // | ||
+ | * Andrew Hund and David Thomas // | ||
* [[wiki> | * [[wiki> | ||
* [[wp> | * [[wp> |
principles/fail_fast.txt · Last modified: 2021-10-18 21:33 by christian