What is Environment.FailFast?

后端 未结 7 1762
别那么骄傲
别那么骄傲 2021-02-01 14:05

What is Environment.FailFast?

How is it useful?

7条回答
  •  粉色の甜心
    2021-02-01 14:23

    Joe Duffy discusses failing fast and the discipline to make it useful, here.

    http://joeduffyblog.com/2014/10/13/if-youre-going-to-fail-do-it-fast/

    Essentially, he's saying that for programming bugs - i.e. unexpected errors that are the fault of the programmer and not the programme user or other inputs or situations that can be reasonable expected to be bad - then deciding to always fail fast for unexpected errors has been seen to improve code quality.

    I think since its an optional team decision and discipline, use of this API in C# is rare since in reality we're all mostly writing LoB apps for 12 people in HR or an online shop at best.

    So for us, we'd maybe use this when we want deny the consumer of our API the opportunity of making any further moves.

提交回复
热议问题