Friday, 23 September 2016

程序员修炼之道读书笔记 27




2016-9-22 17:55:12
Design by Contract (DBC, for short). 契约编程
在自己代码中,经常使用assertion去验证你的假设条件。一旦有违背假设的情况,及时crashing  避免问题继续传播,pollute downstream code, make you life much easier when debugging.

It's much easier to find and diagnose the problem by crashing early, at the site of the problem
再问题已发生的现场(或时候)就及早崩溃,对于诊断和找出问题大有裨益。

No comments:

Post a Comment