As any experienced computer programmer knows, there are unwritten laws that govern software development. However there are no penalties for breaking these laws; rather, there is often a reward. Following are 21 Laws of Computer Programming:
任何一個有經驗的程式員都知道,軟體開發遵循著一些不成文的法則。然而,如果你不遵循這些法則也並不意味著會受到懲罰;相反,有時你還會獲得意外的好處。下面的就是軟體編程中的21條法則:
1. Any given program, once deployed, is already obsolete.
任何程式一旦部署即顯陳舊。
2. It is easier to change the specification to fit the program than vice versa.
修改需求規範來適應程式比反過來做更容易。
3. If a program is useful, it will have to be changed.
一個程式如果很有用,那它註定要被改掉。
4. If a program is useless, it will have to be documented.
一個程式如果沒用,那它一定會有很好的文檔。
5. Only ten percent of the code in any given program will ever execute.
任何程式裡都僅僅只有10%的代碼會被執行到。
6. Software expands to consume all available resources.
軟體會一直膨脹到耗盡所有資源為止。
7. Any non-trivial program contains at least one error.
任何一個有點價值的程式裡都會有至少一個bug。
8. The probability of a flawless demo is inversely proportional to the number of people watching, raised to the power of the amount of money involved.
原型完美的程度跟審視的人數成反比,反比值會隨著涉及的資金數增大。
9. Not until a program has been in production for at least six months will its most harmful error be discovered.
軟體直到被變成產品運行至少6個月後,它最嚴重的問題才會被發現。
10. Undetectable errors are infinite in variety, in contrast to detectable errors, which by definition are limited.
無法檢測到的錯誤的形式無限多樣,而能被檢測到的正好相反,被定義了的十分有限。
11. The effort required to correct an error increases exponentially with time.
修複一個錯誤所需要投入的努力會隨著時間成指數級增加。
12. Program complexity grows until it exceeds the capabilities of the programmer who must maintain it.
軟體的複雜度會一直增加,直到超出維護這個程式的人的承受能力。
13. Any code of your own that you haven’t looked at in months might as well have been written by someone else.
任何自己的程式,幾個月不看,形同其他人寫的。
14. Inside every small program is a large program struggling to get out.
任何一個小程式裡面都有一個巨大的程式蠢蠢欲出。
15. The sooner you start coding a program, the longer it will take.
編碼開始的越早,花費的時間越長。
16. A carelessly planned project takes three times longer to complete than expected; a carefully planned project takes only twice as long.
一個粗心的專案計劃會讓你多花3倍的時間去完成;一個細心的專案計劃只會讓你多花2倍的時間。
17. Adding programmers to a late project makes it later.
往大型項目裡添加人手會使項目更延遲。
18. A program is never less than 90% complete, and never more than 95% complete.
一個程式至少會完成90%,但永遠完成不了超過95%。
19. If you automate a mess, you get an automated mess.
如果你想麻煩被自動處理掉,你得到的是自動產生的麻煩。
20. Build a program that even a fool can use, and only a fool will want to use it.
開發一個傻瓜都會使用的軟體,只有傻瓜願意使用它。
21. Users truly don’t know what they want in a program until they use it.
使用者不會真正的知道要在軟體裡做些什麼,除非使用過。
參考:
[1] http://www.devtopics.com/21-laws-of-computer-programming
[2] http://www.aqee.net/2010/09/30/21-laws-of-computer-programming