2010年10月6日星期三

計算機編程的21法則

在網上看到非常有趣的"計算機編程的21法則(21 Laws of Computer Programming)":

1. 任何程式, 一旦部署, 已經過時.
2. 修改規範以適應程式, 比修改程式以適應規範容易.
3. 如果一個程式是有用的, 它必須被改變.
4. 如果一個程式是沒用的, 它必須被記錄下來.
5. 只有百分之十的代碼會常常被執行.
6. 軟件會擴展到佔用所有可用資源為止.
7. 任何不平凡的程式至少包含一個錯誤.
8. 一個完美示範的可能性跟觀看人數成反比, 隨投入金錢的乘方上升.
9. 最有害的錯誤要直到生產至少六個月之後才被發現.
10. 不可檢測的錯誤有無限變種, 而相比之下, 可檢測的錯誤是有限的.
11. 糾正錯誤需要的努力隨時間呈指數增加.
12. 程式的複雜性增加直到它超出了有關程序員的能力.
13. 你自己的代碼,沒有看過幾個月, 形同別人寫的.
14. 每個小程式裡面都有一個大程式蠢蠢欲動.
15. 越早開始編寫一個程式, 時間越長.
16. 一個不小心計劃的項目需比預期長三倍的時間才能完成, 一個精心策劃的項目只需要兩倍的時間.
17. 為後期項目添加程序員, 使它更遲完成.
18. 一個程式是不低於90%完成, 並從未超過95%完成.
19. 如果你希望麻煩被自動處理, 你只會得到自動的麻煩.
20. 建立一個即使是傻瓜都會用的程式, 只有傻瓜才會想使用它.
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.
6. Software expands to consume all available resources.
7. Any non-trivial program contains at least one error.
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.
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.
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.
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.

原來的文: 21 Laws of Computer Programming



沒有留言:

發佈留言