程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> JSP編程 >> 關於JSP >> 編程之道(完全小趙譯版)中輯

編程之道(完全小趙譯版)中輯

編輯:關於JSP

4.1A program should be light and agile, its subroutines connected like a strings of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little nor too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity.
一個程序應該是輕靈自由的,它的子過程就象串在一根線上的珍珠。自始至終,目標明確。增之一字節則太長,減之一字節則太短。既沒有不必要的循環也沒有沒有被引用的變量,既不缺少結構化也不至於僵硬呆板。
A program should follow the Law of Least Astonishment. What is this law? It is simply that the program should always respond to the user in the way that astonishes him least.
一個程序應該遵循``最小驚訝原則'',什麼是``最小驚訝原則''?就是說一個程序應該最小程度地引起用戶的驚訝。
A program, no matter how complex, should act as a single unit. The program should be directed by the logic within rather than by outward appearances.
無論一個程序無論有多麼復雜都應該是一個單一的整體。程序是被它的內部邏輯所指引而不是它的外觀表現。
If the program fails in these requirements, it will be in a state of disorder and confusion. The only way to correct this is to rewrite the program.
如果一個程序不能滿足所要的需求,它就會處於混亂無序的狀態中。唯一的出路就是重寫這個程序。
 4.2A novice asked the master: "I have a program that sometimes runs and sometimes aborts. I have followed the rules of programming, yet I am totally baffled. What is the reason for this?"
一個初學者問大師:“我的一個程序有時正常有時不正常。我已經完全遵循編程的規則,而且我完全被它弄糊塗了,到底是什麼原因會導致這樣呢?”
The master replied: "You are confused because you do not understand the Tao. Only a fool expects rational behavior from his fellow humans. Why do you expect it from a machine that humans have constructed? Computers simulate determinism; only the Tao is perfect.
大師說:“你困惑是因為你不了解道。只有傻瓜才會相信只要遵循別人所說就能得到想當然的結果。為什麼你要從一個人類自己構造的機器中去得到想當然的結果呢?計算機只是決定論的產物;只有道才是唯一完美的。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved