(來源:http://www.lslnet.com) Translated By Geoffrey James
[小趙]翻譯整理
Table of Contents 目錄
Thus spake the master programmer:
編程大師如是說:
"When you have learned to snatch the error code from the trap frame, it will be time for you to leave."
“當你從我手中奪走水晶球時,就是你離開的時候了?!?/font>
If the Tao is great, then the operating system is great. If the operating system is great, then the compiler is great. If the compiler is greater, then the applications is great. The user is pleased and there is harmony in the world.
如果道是完美的,那么操作系統就是完美的,如果操作系統是完美的,那么編譯囂就是完美的,如果編譯囂是完美的,那么應用程序就是完美的,所以用戶心滿意足,整個世界因此和諧。
The Tao of Programming flows far away and returns on the wind of morning.
編程之道去如黃鶴來如晨風。
The assembler gave birth to the compiler. Now there are ten thousand languages.
匯編器生編譯器,最后產生上萬種高級語言。
Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.
不論多么的微不足道,每種語言都有它自己的目的,每種語言都表達了軟件的陰陽兩極。每種語言都各得其道。
But do not program in COBOL if you can avoid it.
但是盡量不要用COBOL語言。
Programmers that do not comprehend the Tao are always running out of time and space for their programs. Programmers that comprehend the Tao always have enough time and space to aclearcase/" target="_blank" >ccomplish their goals.
不懂編程之道的程序員常常把空間和時間消耗殆盡,得道的程序員則總是有足夠的空間和時間去完成編程任務。
How could it be otherwise?
否則會是什么樣呢?
If it were not for laughter, there would be no Tao.
大笑不足為道。
The highest sounds are the hardest to hear. Going forward is a way to retreat. Greater talent shows itself late in life. Even a perfect program still has bugs.
希音不聞,進即是退,大囂晚成。任何程序都有漏洞。
Thus spake the master programmer:
編程大師如是說:
"After three days without programming, life becomes meaningless."
三日不編程,食肉無味。
Aware, like a fox crossing the water. Alert, like a general on the battlefield. Kind, like a hostess greeting her guests. Simple, like uncarved blocks of wood. Opaque, like black pools in darkened caves.
他達明,如狐貍過水;機警,如戰場上的將軍;和善,如主婦款待客人;簡單,呆若木雞;混沌,如深淵之水。
Who can tell the secrets of their hearts and minds?
誰能道盡他們的所有?
The answer exists only in the Tao.
答案僅存于道。
"I don't know whether I am Turing dreaming that I am a machine, or a machine dreaming that I am Turing!"
“我不知道是圖靈夢見自己變成機器還是機器夢見自己變成圖靈?!?/font>
The manager said: "I should have never sent you to the conference. Those programmers live beyond the physical world. They consider life absurd, an accidental coincidence. They come and go without knowing limitations. Without a care, they live only for their programs. Why should they bother with social conventions?"
他的主管說:“我不應該讓你參加這次會議,這些程序員生活在現實世界之外。他們認為生活是可笑的,一場意外的偶然而已。他們來去自由,無所牽掛,他們只為他們的程序生活。為什么要用世俗的煩擾去擾亂他們呢?”
"They are alive within the Tao."
“他們生活在道中”。
The Master replies: "That programmer has mastered the Tao. He has gone beyond the need for design; he does not become angry when the system crashes, but accepts the universe without concern. He has gone beyond the need for documentation; he no longer cares if anyone else sees his code. He has gone beyond the need for testing; each of his programs are perfect within themselves, serene and elegant, their purpose self-evident. Truly, he has entered the mystery of the Tao."
經理說:“那個程序員掌握了道。他不需要預先進行設計;系統崩潰時他也從不煩燥,只是接受發生的一切而不管發生的事是好是壞 。他不需要寫文檔,他從不顧及有沒有人看他寫的代碼。他也不需要進行測試;他寫的每個程序都有一個完美的自我,平靜而優雅,它們的目的不言自明。他已經真正掌握了道的精髓?!?/font>
Thus spake the master programmer:
編程大師如是說:
"When program is being tested, it is too late to make design changes."
“程序被測試時再去改變它的設計已經太晚了?!?/font>
"I am a great thief, renowned for my feats of shoplifting. Be forewarned, for this trade show shall not escape unplundered."
“先警告你,我是偷盜高手,我入室偷盜的本領聞名遐邇。這次展覽會也再劫難逃?!?/font>
This speech disturbed the guard greatly, because there were millions of dollars of computer equipment inside, so he watched the man carefully. But the man merely wandered from booth to booth, humming quietly to himself.
警衛因此大動干戈,因為里面有價值百萬的計算機設備,所以他牢牢盯緊了這個人,但是這個人只是從一個攤位逛到另一個攤位,一邊平靜地喃喃自語。
When the man left, the guard took him aside and searched his clothes, but nothing was to be found.
當這個人離開時,警衛搜了他的身,但是什么也沒有發現。
On the next day of the trade show, the man returned and chided the guard saying: "I escaped with a vast booty yesterday, but today will be even better." So the guard watched him ever more closely, but to no avail.
展覽會的第二天,這個人又對警衛說:“昨天我滿載而歸,但是今天我會收獲更大?!彼跃l更加小心地盯緊他,但是這樣做完全于事無補。
On the final day of the trade show, the guard could restrain his curiosity no longer. "Sir Thief," he said, "I am so perplexed, I cannot live in peace. Please enlighten me. What is it that you are stealing?"
展覽會的最后一天,警衛再也不能忍住他的好奇心了?!靶⊥迪壬?,”他說,“ 你說我驚慌不安,請告訴我,你到底偷了什么?”。
The man smiled. "I am stealing ideas," he said.
這個人笑笑說:“我在偷想法?!?/font>
"An operating system," replied the programmer.
“是操作系統”,這位程序員回答說。
The warlord uttered an exclamation of disbelief. "Surely an accounting package is trivial next to the complexity of an operating system," he said.
此人大惑不解。他說:“顯然一個財務軟件比起操作系統來說其復雜性是微不足道的”。
"Not so," said the programmer, "when designing an accounting package, the programmer operates as a mediator between people having different ideas: how it must operate, how its reports must appear, and how it must conform to the tax laws. By contrast, an operating system is not limited my outside appearances. When designing an operating system, the programmer seeks the simplest harmony between machine and ideas. This is why an operating system is easier to design."
程序員說:“不,設計財務軟件時,一個程序員必須成為持不同意見的用戶與計算機的一個中介,他必須了解用戶的操作習慣,報表要是什么形式,如何遵循稅法。相反,一個操作系統完全與這些外部的東西無關。設計操作系統,程序員只需要達到自己的設想與機器之間的簡單的和諧。這就是為什么操作系統反而比財務軟件更容易設計?!?/font>
The warlord of Wu nodded and smiled. "That is all good and well, but which is easier to debug?"
這些人笑著說?!安诲e,但是哪一個更容易調試呢?”
The programmer made no reply.
程序員沒有回答。
"It will take one year," said the master promptly.
“一年”,大師說。
"But we need this system immediately or even sooner! How long will it take it I assign ten programmers to it?"
“但是我們等不了那么長時間,越快越好,如果10程序員呢?”
The master programmer frowned. "In that case, it will take two years."
大師皺了一下眉頭說:“那就要花2年”。
"And what if I assign a hundred programmers to it?"
“那,100年程序員呢?”
The master programmer shrugged. "Then the design will never be completed," he said.
大師聳了聳肩說:“那這個項目就永遠完不成了?!?/font>
Thus spake the master programmer:
編程大師如是說:
"A well-written program is its own heaven;
a poorly-written program is its own hell."
“寫的好的程序是它自己的天堂,寫的不好的程序是它自己的地獄”
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.
如果一個程序不能滿足所要的需求,它就會處于混亂無序的狀態中。唯一的出路就是重寫這個程序。
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."
任何編程的規則都只適合于特定的情況,只有道才是永恒不變的。所以在你受到指引之前要先去思考道?!?/font>
"But how will I know when I have received enlightenment?" asked the novice.
“但是我怎么知道我何時受到指引呢?”
"Your program will then run correctly," replied 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.
大師咳嗽了一聲,稍微動了一下,說,“今天的課就到這里”。
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."
“技巧?”,大師轉過身說,“我所遵循的是道--它超乎所有的技巧。當我開始編程時我看到的是整個一大塊的程序,三年后我看到的是子過程?,F在我什么也看不到了。我的整個存在是沒有任何形式的虛無。我感覺很悠閑,總之,事實上是我的程序自己在寫,有時我看到一些問題,我看到它們,就停下來靜靜地觀察它們,然后我改變了一行代碼,難題就象一陣輕煙一樣化為烏有。然后我編譯程序。坐在那里享受工作的喜悅。閉了一會眼睛然后退出系統。
Price Wang said, "Would that all of my programmers were as wise!"
“什么時候我的程序員才能都達到這樣的境界!”
Thus spake the master programmer:
編程大師如是說:
"Though a program be but three lines long, someday it will have to be maintained."
“既使一個程序只有三行長,也總有一天需要去維護它”
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.
"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.
程序員想了一想說?!斑€有一些新的功能要加進去,可能至少要兩個星期吧?!?/font>
"Even that is too much to expect," insisted the manager, "I will be satisfied if you simply tell me when the program is complete."
“即使兩個星期恐怕也太夸張了,什么時候你只要告訴我說程序已經完成就好了?!?/font>
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.
幾年后,這個經理已經退休了,在他的離職午餐上,他發現這些程序員在他的終端前睡著了,他整夜都在編程。
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."
主管要求解釋時,程序員被激怒了:“你太沒耐心了,我會在最后寫財務的部分?!?/font>
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?
一個好的農民不會不管他的莊稼。
一個好的老師不會不管哪怕是最差的學生。
一個好的父親不會讓他的任何一個孩子挨餓。
一個好的程序員不應拒絕維護他的程序。
Thus spake the master programmer:
編程大師如是說:
"Let the programmer be many and the managers few -- then all will be productive."
“增加程序員,減少經理--這樣他們都可提高效率?!?/font>
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.
經理分配任務時不會包括游戲,會計師做長期計劃時,應該做到面面俱到,皆大歡喜??茖W家提出一個問題,就會很快得到解決。
Truly, this is the Tao of Programming.
這才是編程之道。
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.
在糟糕的管理下工作,他們享受不到工作的樂趣。
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."
這位程序員又一次拒絕了,他說:“我是一個程序員所以我可以編程,如果我被提升了,除了浪費別人的時間什么也做不了,現在我可以走了嗎?我還有一個程序沒寫完?!?/font>
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.
經理又說:“好吧,那隨你們的便,只要能按時完成任務?!?,程序員們這下滿意了,他們中午上班,一直工作到凌晨。
Thus spake the master programmer:
編程大師如是說:
"You can demonstrate a program for a corporate executive, but you can't make him computer literate."###
The master replies: "You perceive this immense structure and are disturbed that it has no rational purpose. Can you not take amusement from its endless gyrations? Do you not enjoy the untroubled ease of programming beneath its sheltering branches? Why are you bothered by its uselessness?"
大師說:“你已經知道這個巨大的機構并不合理,你就不能不管它為什么這樣嗎?你盡管享受它的好處就是了,干嗎要去管它到底是沒有效率呢?”
The novice programmer stares in wonder at the bird, for he understands it not. The average programmer dreads the coming of the bird, for he fears its message. The master programmer continues to work at his terminal, for he does not know that the bird has come and gone.
初學者驚恐地看著這只鳥,根本不敢相信,中級程序員擔心這只鳥的到來,因為它害怕它帶來的消息,編程大師則繼續在他的終端前工作他根本不知道這只鳥曾經來過。
"This is an integrated, distributed, general-purpose workstation," began the magician, "ergonomically designed with a proprietary operating system, sixth generation languages, and multiple state of the art user interfaces. It took my assistants several hundred man years to construct. Is it not amazing?"
“這是綜合的、分布式的通用工作站,”,學究開始介紹了,“按人體工學設計的操作系統,第六代的高級語言,多樣的用戶界面,整整花了我的助手好幾百人年的時間,挺不錯吧?”
The master raised his eyebrows slightly. "It is indeed amazing," he said.
大師揚了一下眉毛,說:“的確很了不起?!?
"Corporate Headquarters has commanded," continued the magician, "that everyone use this workstation as a platform for new programs. Do you agree to this?"
“頭兒已經說了,”這位學究繼續說,“每個人都要用這個工作站作平臺,你覺得怎么樣?”
"Certainly," replied the master, "I will have it transported to the data center immediately!" And the magician returned to his tower, well pleased.
“當然了,”,大師回答說,“我要馬上把它送到數據中心去!”,這位學究滿意去回去了。
Several days later, a novice wandered into the office of the master programmer and said, "I cannot find the listing for my new program. Do you know where it might be?"
幾天后,一個新手走進大師的辦公室說,“我找不到我新寫的程序了,你知道它可能會在哪兒嗎?”
"Yes," replied the master, "the listings are stacked on the platform in the data center."
“當然,”,大師說,“你的程序在數據中心的平臺里放著?!?
Thus spake the master programmer:
"Without the wind, the grass does not move.
Without software, hardware is useless."
風不動則草不動,
沒有軟件,硬件只是一堆發熱的電子器件
The master replied, "Why do you ask such foolish questions? That company is large because it is so large. If it only made hardware, nobody would buy it. If it only maintained systems, people would treat it like a servant. But because it combines all of these things, people think it one of the gods! By not seeking to strive, it conquers without effort."
大師說,“為什么你問如此愚蠢的問題呢?那家公司大是因為它就是如此之大,如果它只做硬件,就沒有人會買,如果它只維護系統,人們只會把它當作仆人,但是它的業務囊括了所有這些東西,人們就對它頂禮莫拜好象不用努力奮斗就可擊敗競爭對手
The novice bolted to attention and handed the device to the master. "I see that the device claims to have three levels of play: Easy, Medium, and Hard", said the master. "Yet every such device has another level of play, where the device seeks not to conquer the human, nor to be conquered by the human."
新手把游戲機遞給大師,“我看到上面說明了三種難度的玩法:容易,中等,高難”,大師說,“但是每個這樣的游戲機都有另外一種玩法,此時游戲機即不是想著怎么贏你,也不是怎么被你贏?!?
"Pray, great master," implored the novice, "how does one find this mysterious setting?"
“那么請問大師”,初學者說,“這種玩法到底是怎樣玩的呢?”
The master dropped the device to the ground and crushed it under foot. And suddenly the novice was enlightened.
大師把游戲機摔到地下然后用腳踩碎它,突然初學者明白了。
The mainframe programmer then began to describe his system to his friend, saying: "The mainframe sits like an ancient sage meditating in the midst of the data center. Its disk drives lie end-to-end like a great ocean of machinery. The software is a multi-faceted as a diamond and as convoluted as a primeval jungle. The programs, each unique, move through the system like a swift-flowing river. That is why I am happy where I am."
大型機的程序員對他的朋友說:“大型機就象古代圣賢一樣深思熟慮,它的磁盤設備從頭到尾就象是一個巨大的機械設備的海洋。軟件象鉆石一樣有多個面,象遠古的森林一樣令人費解。每一個程序都象水經過河流一樣穿行于系統中,那就是為什么我樂于為它工作”
The microcomputer programmer, upon hearing this, fell silent. But the two programmers remained friends until the end of their days.
微機程序員聽了這些話后,默默不語,但這兩個程序員至死都是很好的朋友
Presently, they met Firmware, who was dressed in tattered rags, and hobbled along propped on a thorny stick. Firmware said to them: "The Tao lies beyond Yin and Yang. It is silent and still as a pool of water. It does not seek fame, therefore nobody knows its presence. It does not seeks fortune, for it is complete within itself. It exists beyond space and time."
不久,它們遇到了固件,固件衣衫襤褸,拄著一根拐棍步履蹣跚。固件對它們說:“道在于陰陽之外。它靜如止水,它從不指望能揚名遠近,所以沒有人知道它的存在。它也不尋求幸福,它只是與它自己的存在在一起,它存在于空間和時間之外?!?/font>
Software and Hardware, ashamed, returned to their homes.
軟件和硬件面有慚色,各自回了家。
Thus spake the master programmer: 編程大師如是說:
"Time for you to leave."
“現在是你出師的時候了?!?