Rob Pike 得到的最好的编程建议

当年他刚加入贝尔实验室不久,与 Ken Thompson 结对编程。从 Ken 身上学到:发现 bug 时别急着动手 debug(加 print 语句或调用 debugger),不然容易只修复了局部问题;应该跳出来一点,全局思考大的模型大的系统的设计有什么问题,为啥会引入这个 bug。

"Ken taught me that thinking before debugging is extremely important. If you dive into the bug, you tend to fix the local issue in the code, but if you think about the bug first, how the bug came to be, you often find and correct a higher-level problem in the code that will improve the design and prevent further bugs."

一人一首成名曲:Rob Pike 其实是多首成名曲-- UTF-8 联合发明人,Go 语言设计者之一,30年来经久不衰的 The Unix Programming Environment 作者之一。