gpt4 book ai didi

fail-fast-fail-early - 表达式 "Fail Early"是什么意思,你想什么时候这样做?

转载 作者:行者123 更新时间:2023-12-03 10:39:38 32 4
gpt4 key购买 nike

“Fail Early”是什么意思,在什么情况下这种方法最有用,你什么时候会避免这种方法?

最佳答案

本质上,快速失败 (又名 尽早失败 )是对您的软件进行编码,使得 当出现问题时,软件会尽快并尽可能明显地失败 ,而不是试图在可能不稳定的状态下进行。

Fail Fast
by Jim Shore
edited by Martin Fowler
http://www.martinfowler.com/ieeeSoftware/failFast.pdf

...
Fortunately, there’s a simple technique that will dramatically reduce the number of these bugs in your software. It won’t reduce the overall number of bugs, at least not at first, but it’ll make most defects much easier to find.

The technique is to build your software to “fail fast.”

Immediate and visible failure

Some people recommend making your software robust by working around problems automatically. This results in the software “failing slowly.” The program continues working right after an error but fails in strange ways later on.

A system that fails fast does exactly the opposite: when a problem occurs, it fails immediately and visibly. Failing fast is a nonintuitive technique: “failing immediately and visibly” sounds like it would make your software more fragile, but it actually makes it more robust. Bugs are easier to find and fix, so fewer go into production.
...



还要注意快速失败迭代器的相关概念 - 迭代器在对迭代器外部的集合进行某些修改后,会尽快抛出,而不是在潜在的不稳定或非确定性状态下继续。

关于fail-fast-fail-early - 表达式 "Fail Early"是什么意思,你想什么时候这样做?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2807241/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com