引用vanderZwan · 2013-06
“there's empirical data indirectly suggesting that using curly braces for scoping might lead to less mistakes when reading code:”
引用实验间接表明用花括号划定作用域可能减少读代码的错误
实验表明细微的写法差异就能显著影响读代码的正确率与用时
论文让有编程经验的参与者预测十个小型 Python 程序的精确输出,并利用程序版本间的细微差别,显示看似无关紧要的符号改动会显著影响正确率和响应时间。结果表明经验在多数情况下提升表现,但当关于相关代码语句的隐含假设被打破时,经验反而可能明显拖累表现。
评论者把它当作经验证据,用来支持“用花括号界定作用域可能减少读代码时的错误”,即空白缩进可能误导读者的说法。
“there's empirical data indirectly suggesting that using curly braces for scoping might lead to less mistakes when reading code:”