📜 ⬆️ ⬇️

Fail Fast! principle: debug less and create more reliable software

image
When an error occurs in an application, there are two diametrically opposite approaches to handling this error:
Forgive! approach: the application continues to run and tries to minimize the consequences of the error.
Fail Fast! approach: the application immediately stops working and reports an error.


To answer these questions, take a look at a simple example.

Suppose we have to write a simple web page that displays a warning next to the fountain that the water in it is polluted.
The following HTML code performs this task:
<html> <body> <h2 style="color:red;">Important!</h2> <p>Please <b>DO NOT</b> drink this water!</p> </body> </html> 

The result of this code in the browser will look like this:
image

Now we will make a small mistake inside the HTML code.
Instead of a tag, we use a tag.
    DO NOT,    : 
<p>Please <b>DO NOT<b> drink this water!</p>
:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
    DO NOT,    : 
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
    DO NOT,    : 
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .
DO NOT, :
<p>Please <b>DO NOT<b> drink this water!</p>

:
? ?

. HTML- . Firefox, Google Chrome, Internet Explorer, Opera Safari :
image

, Forgive!, . , , . . !

: Forgive! !

. <b DO NOT, :
<p>Please <b DO NOT</b> drink this water!</p>
:
image

! , , . . , , -.

: Forgive! !

, - . , " " . , Mariner 1 - " ". List of software bugs .

, Forgive! . , " ?"

, . , , .
:
Fail fast!

:
Fail fast! . - , , , . , Fail fast! . , . , , . , .

, , . , ---. , Fail fast! . , , , , . "", . , . "" " ". Fail fast! .

. , , . , Fail fast! , . - . Forgive! " ".

- Fail fast!, . , , , (", ... abc.tmp"), .

:
Fail fast! . :
Fail fast!. , , , . , , Forgive! .


Rule of Repair The Art of Unix Programming , :
- , .

6 - , :
, , , " ", .

, - , Fail fast! . , Fail fast! , . , , :
var table_row_index = 1 ... table_row_indx = table_row_index + 1

Fail fast!. / .

Fail fast! , . :
, , , .

(= + + ), , .

:
, , fail fast fail fast .
.
. Assert
. fail fast .
, - .

')

Source: https://habr.com/ru/post/218325/


All Articles