国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

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

2024-07-21 02:28:02
字體:
來源:轉載
供稿:網友

4.1

a 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.2

a 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.
大師說:“你困惑是因為你不了解道。只有傻瓜才會相信只要遵循別人所說就能得到想當然的結果。為什么你要從一個人類自己構造的機器中去得到想當然的結果呢?計算機只是決定論的產物;只有道才是唯一完美的。
the rules of programming are transitory; only the tao is eternal. therefore you must contemplate the tao before you receive enlightenment."
任何編程的規則都只適合于特定的情況,只有道才是永恒不變的。所以在你受到指引之前要先去思考道。”
"but how will i know when i have received enlightenment?" asked the novice.
“但是我怎么知道我何時受到指引呢?”
"your program will then run correctly," replied the master.
“當你的程序正確運行時”。大師說。

4.3

a master was explaining the nature of the tao to one of his novices, "the tao is embodied in all software -- regardless of how insignificant," said the master.
初學者請大師解釋“道法自然”。大師說:“道存在于任何軟件中--無論是多么沒有意義的軟件”。
"is the tao in a hand-held calculator?" asked the novice.
“難道也存在于手持式的計算囂里?”,初學者問。
"it is," came the reply.
“是的,”
"is the tao in a video game?" continued the novice.
“也在游戲機里?”,初學者又問到。
"it is even in a video game," said the master.
“是的,甚至也存在于游戲機里”。大師說。
"and is the tao in the dos for a personal computer?"
“也存在于個人計算機的dos里嗎?”
the master coughed and shifted his position slightly. "the lesson is over for today," he said.
大師咳嗽了一聲,稍微動了一下,說,“今天的課就到這里”。

4.4

price wang's programmer was coding software. his fingers danced upon the keyboard. the program compiled without an error message, and the program ran like a gentle wind.
###編程大師編寫軟件時,手指在鍵盤上快速飛舞。程序編譯時沒有一條錯誤信息,程序運行起來就象一陣微風吹過。
excellent!" the price exclaimed, "your technique is faultless!"
太精彩了!你的技巧已經無可挑剔了。
"technique?" said the programmer, turning from his terminal, "what i follow is the tao -- beyond all technique. when i first began to program i would see before me the whole program in one mass. after three years i no longer saw this mass. instead, i used subroutines. but now i see nothing. my whole being exists in a formless void. my senses are idle. my spirit, free to work without a plan, follows its own instinct. in short, my program writes itself. true, sometimes there are difficult problems. i see them coming, i slow down, i watch silently. then i change a single line of code and the difficulties vanish like puffs of idle smoke. i then compile the program. i sit still and let the joy of the work fill my being. i close my eyes for a moment and then log off."
“技巧?”,大師轉過身說,“我所遵循的是道--它超乎所有的技巧。當我開始編程時我看到的是整個一大塊的程序,三年后我看到的是子過程。現在我什么也看不到了。我的整個存在是沒有任何形式的虛無。我感覺很悠閑,總之,事實上是我的程序自己在寫,有時我看到一些問題,我看到它們,就停下來靜靜地觀察它們,然后我改變了一行代碼,難題就象一陣輕煙一樣化為烏有。然后我編譯程序。坐在那里享受工作的喜悅。閉了一會眼睛然后退出系統。
price wang said, "would that all of my programmers were as wise!"
“什么時候我的程序員才能都達到這樣的境界!”

mainteance
book five


thus spake the master programmer:
編程大師如是說:
"though a program be but three lines long, someday it will have to be maintained."
“既使一個程序只有三行長,也總有一天需要去維護它”

5.1

a well-used door needs no oil on its hinges.
a swift-flowing steam does no grow stagnant.
neither sound nor thoughts can travel through a vacuum.
software rots if not used.

經常使用的門不需要往門軸里上油。
流動的東西就不會停滯不前。
流水不腐,戶樞不蠹。--王磊
聲音和思想都不能在真空里傳播。
軟件不用就會腐朽。

these are great mysteries.

5.2

a manager asked a programmer how long it would take him to finish the program on which he was working. "i will be finished tomorrow," the programmer promptly replied.
經理問程序員要多長時間才能完成他的項目。“明天”
"i think you are being unrealistic," said the manager. "truthfully, how long will it take?"
“太不著邊際了,老實說,要多久?”
the programmer thought for a moment. "i have some features that i wish to add. this will take at least two weeks," he finally said.
程序員想了一想說。“還有一些新的功能要加進去,可能至少要兩個星期吧。”
"even that is too much to expect," insisted the manager, "i will be satisfied if you simply tell me when the program is complete."
“即使兩個星期恐怕也太夸張了,什么時候你只要告訴我說程序已經完成就好了。”
the programmer agreed to this.
several years slated, the manager retired. on the way to his retirement lunch, he discovered the programmer asleep at his terminal. he had been programming all night.
幾年后,這個經理已經退休了,在他的離職午餐上,他發現這些程序員在他的終端前睡著了,他整夜都在編程。

5.3

a novice programmer was once assigned to code a simple financial package.
一個初學者被要求編寫一個財務軟件。

the novice worked furiously for many days, but when his master reviewed his program, he discovered that it contained a screen editor, a set of generalized graphics routines, and artificial intelligence interface, but not the slightest mention of anything financial.
他瘋狂地工作了很多天,但他的主管檢視他的程序時發現,它寫了一個編輯囂,一個圖形程序集,和人工智能的界面,但是看不到任何跟財務有關的東西。
when the master asked about this, the novice became indignant. "don't be so impatient," he said, "i'll put the financial stuff in eventually."
主管要求解釋時,程序員被激怒了:“你太沒耐心了,我會在最后寫財務的部分。”

5.4

does a good farmer neglect a crop he has planted?
does a good teacher overlook even the most humble student?
does a good father allow a single child to starve?
does a good programmer refuse to maintain his code?

一個好的農民不會不管他的莊稼。
一個好的老師不會不管哪怕是最差的學生。
一個好的父親不會讓他的任何一個孩子挨餓。
一個好的程序員不應拒絕維護他的程序。


management
book six


thus spake the master programmer:
編程大師如是說:
"let the programmer be many and the managers few -- then all will be productive."
“增加程序員,減少經理--這樣他們都可提高效率。”

6.1

when managers hold endless meetings, the programmers write games. when accountants talk of quarterly profits, the development budget is about to be cut. when senior scientists talk blue sky, the clouds are about to roll in.
經理們忙于無休無止的會議時,程序員們在寫游戲。財務主管在談論季度盈利時開發預算將會被削減。當老科學家在談天空的藍色時,云團蜂擁而至。
truly, this is not the tao of programming.
這不是編程之道。
when managers make commitments, game programs are ignored. when accountants make long-range plans, harmony and order are about to be restored. when senior scientists address the problems at hand, the problems will soon be solved.
經理分配任務時不會包括游戲,會計師做長期計劃時,應該做到面面俱到,皆大歡喜。科學家提出一個問題,就會很快得到解決。
truly, this is the tao of programming.
這才是編程之道。

6.2

why are programmers non-productive? because their time is wasted in meetings.
為什么程序員沒有效率,因為他們把時間都浪費在開會上了。
why are programmers rebellious? because the management interferes too much.
為什么程序員難于管理?因為管理者的干預太多了。
why are the programmers resigning one by one? because they are burnt out.
為什么程序員一個接一個地辭職,因為他們累壞了。
having worked for poor management, they no longer value their jobs.
在糟糕的管理下工作,他們享受不到工作的樂趣。

6.3

a manager was about to be fired, but a programmer who worked for him invented a new program that became popular and sold well. as a result, the manager retained his job.
一個經理將被解雇,但他手下的一個程序員寫了一個流行的軟件并且銷路很旺。所以經理保住了他的工作。
the manager tried to give the programmer a bonus, but the programmer refused it, saying, "i wrote the program because i though it was an interesting concept, and thus i expect no reward."
經理為程序員分紅,但程序員拒絕了,他說:“我寫程序是因為寫程序很有趣,所以我并沒想過得資金”。
the manager, upon hearing this, remarked, "this programmer, though he holds a position of small esteem, understands well the proper duty of an employee. lets promote him to the exalted position of management consultant!"
這位經理說,“這位程序員,不管他現在是什么位置,他都能理解一個雇員的職責所在。我們要把他提升為管理顧問”。
but when told this, the programmer once more refused, saying, "i exist so that i can program. if i were promoted, i would do nothing but waste everyone's time. can i go now? i have a program that i'm working one."
這位程序員又一次拒絕了,他說:“我是一個程序員所以我可以編程,如果我被提升了,除了浪費別人的時間什么也做不了,現在我可以走了嗎?我還有一個程序沒寫完。”

6.4

a manger went to his programmers and told them: "as regards to your work hours: you are going to have to come in at nine in the morning and leave at five in the afternoon." at this, all of them became angry and several resigned on the spot.
經理對程序員說,“你們的工作時間是早上9點到正午點。”,所有的程序員都很不滿。
so the manager said: "all right, in that case you may set your own working hours, as long as you finish your projects on schedule." the programmers, now satisfied, began to come in a noon and work to the wee hours of the morning.
經理又說:“好吧,那隨你們的便,只要能按時完成任務。”,程序員們這下滿意了,他們中午上班,一直工作到凌晨。

corporate wisdom
book seven


thus spake the master programmer:
編程大師如是說:
"you can demonstrate a program for a corporate executive, but you can't make him computer literate."
###
“你可以向一位公司主管演示一套程序,但你不能讓他的電腦變得象人一樣。” 
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • 發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 炉霍县| 浦江县| 遂宁市| 泗阳县| 枞阳县| 德保县| 民权县| 额济纳旗| 宜宾市| 玉屏| 老河口市| 克东县| 安远县| 托里县| 兴和县| 锡林浩特市| 太康县| 万年县| 抚松县| 温泉县| 米林县| 昌邑市| 商南县| 大姚县| 内乡县| 贵溪市| 闽清县| 越西县| 满城县| 石台县| 清远市| 麻江县| 都匀市| 武穴市| 乌什县| 安岳县| 延吉市| 潮州市| 陆丰市| 屏东县| 临猗县|