[转]想成为出色的程序员,你必须承认你是个糟糕的程序员
2007-11-08 09:41
393 查看
// from: http://blog.joycode.com/saucer/archive/2007/11/06/110035.aspx
想成为出色的程序员,你必须承认你是个糟糕的程序员
Ted Neward在最近的博客里引用了这个博客里的有点“禅”味的句子,
To be a Great Programmer, you must admit that you are a Terrible Programmer
(想成为出色的程序员,你必须承认你是个糟糕的程序员)
然后他说,
"I am human, therefore I make mistakes. If I make mistakes, then I cannot assume that I will write code that has no mistakes. If I cannot write code that has no mistakes, then I must assume that mistakes are rampant within the code. If mistakes are rampant within the code, then I must find them. But because I make mistakes, then I must also assume that I make mistakes trying to identify the mistakes in the code. Therefore, I will seek the best support I can find in helping me find the mistakes in my code."
(我是人,因此我犯错。如果我犯错,那么我不能假定我写的代码不会有错。如果我不能写出没有错的代码,那么我必须假定代码内错误横行。如果代码内错误横行,那么我必须找到它们。但因为我犯错,那么我还必须假定在代码内试着找错时也会犯错。因此,我必须寻求我所能找到的最好的支持,来帮我在我的代码内找到错误。)
这样的支持包括,
1. 使用一门静态类型的语言 (编译时和运行时的类型检查等),使用静态分析工具(Static Analysis Tool)
2. 大量使用断言(assertion)
3. 疯狂的测试(Testing Masochism--Masochism,根据在线字典,是受虐狂(“sexual pleasure obtained from receiving punishment (physical or psychological)”)的意思,即到了“以测试为乐,以break one’s own code为乐”的境地),追求测试涵盖范围至百分之百
4. 冷酷但诚实的代码评审
5. 对可见系统当机(Visible Crash)的追求(即不隐藏错误/异常,让错误/异常以导致当机的形式暴露出来)
鉴于多线程/并发代码中的缺陷很难找,Ted Neward认为业界里流行的说法“dynamic-language-authored code can be proven correct by simple use of unit tests(用动态语言编写的代码使用单元测试即可证明其之正确性)”是有问题的,认为我们需要各种形式的支持,我们需要更好的静态分析工具,而不是完全抛弃它们。
想成为出色的程序员,你必须承认你是个糟糕的程序员
Ted Neward在最近的博客里引用了这个博客里的有点“禅”味的句子,
To be a Great Programmer, you must admit that you are a Terrible Programmer
(想成为出色的程序员,你必须承认你是个糟糕的程序员)
然后他说,
"I am human, therefore I make mistakes. If I make mistakes, then I cannot assume that I will write code that has no mistakes. If I cannot write code that has no mistakes, then I must assume that mistakes are rampant within the code. If mistakes are rampant within the code, then I must find them. But because I make mistakes, then I must also assume that I make mistakes trying to identify the mistakes in the code. Therefore, I will seek the best support I can find in helping me find the mistakes in my code."
(我是人,因此我犯错。如果我犯错,那么我不能假定我写的代码不会有错。如果我不能写出没有错的代码,那么我必须假定代码内错误横行。如果代码内错误横行,那么我必须找到它们。但因为我犯错,那么我还必须假定在代码内试着找错时也会犯错。因此,我必须寻求我所能找到的最好的支持,来帮我在我的代码内找到错误。)
这样的支持包括,
1. 使用一门静态类型的语言 (编译时和运行时的类型检查等),使用静态分析工具(Static Analysis Tool)
2. 大量使用断言(assertion)
3. 疯狂的测试(Testing Masochism--Masochism,根据在线字典,是受虐狂(“sexual pleasure obtained from receiving punishment (physical or psychological)”)的意思,即到了“以测试为乐,以break one’s own code为乐”的境地),追求测试涵盖范围至百分之百
4. 冷酷但诚实的代码评审
5. 对可见系统当机(Visible Crash)的追求(即不隐藏错误/异常,让错误/异常以导致当机的形式暴露出来)
鉴于多线程/并发代码中的缺陷很难找,Ted Neward认为业界里流行的说法“dynamic-language-authored code can be proven correct by simple use of unit tests(用动态语言编写的代码使用单元测试即可证明其之正确性)”是有问题的,认为我们需要各种形式的支持,我们需要更好的静态分析工具,而不是完全抛弃它们。
相关文章推荐
- 成为优秀程序员就必须具备的七个优点
- 程序员如何成为一位出色的项目经理?
- 如何成为一名出色的程序员[国庆篇]
- 程序员如何成为一位出色的项目经理?
- 如何成为一个糟糕的程序员
- 成为好程序员必须避免的5个坏习惯
- 想成为 Linux 下专业的 C/C++ 程序员,下面工具都是必须要了解的。
- 想成为嵌入式程序员必须知道的问题
- iOS 性能调优, 成为一名合格 iOS 程序员必须掌握的技能
- 如何成为一个糟糕的程序员
- 通过艰难六部成为一个出色的程序员
- iOS 性能调优,成为一名合格iOS程序员必须掌握的技能
- 重新出发,努力成为一个出色的程序员
- 想成为高级程序员,学习英语是必须的
- iOS 性能调优,成为一名合格iOS程序员必须掌握的技能
- 想成为优秀的程序员,必须要做到这10条法则
- 如何成为一个糟糕的程序员
- 想成为嵌入式程序员必须知道的0x10个问题(转载)
- 想成为优秀的程序员你必须做到的几件事情
- 成为好程序员必须避免的5个坏习惯