The Silent Void Book One 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." “當(dāng)你從我手中奪走水晶球時(shí),就是你離開的時(shí)候了。” 1.1 Something mysterious is formed, born in the silent void. Waiting alone and unmoving, it is at once still and yet in constant motion. It is the source of all programs. I do not know its name, so I will call it the Tao of Programming. 寂靜的虛空里誕生了神秘的東西,這種東西恒久存在永不消失,它是所有程序的根源所在,我不知道怎么形容它,姑且稱它為編程之道。 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. 如果道是完美的,那么操作系統(tǒng)就是完美的,如果操作系統(tǒng)是完美的,那么編譯囂就是完美的,如果編譯囂是完美的,那么應(yīng)用程序就是完美的,所以用戶心滿意足,整個(gè)世界因此和諧。 The Tao of Programming flows far away and returns on the wind of morning. 編程之道去如黃鶴來如晨風(fēng)。 1.2 The Tao gave birth to machine language. Machine language gave birth to the assembler. 道生機(jī)器語(yǔ)言,機(jī)器語(yǔ)言生匯編囂。 The assembler gave birth to the compiler. Now there are ten thousand languages. 匯編器生編譯器,最后產(chǎn)生上萬種高級(jí)語(yǔ)言。 Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. 不論多么的微不足道,每種語(yǔ)言都有它自己的目的,每種語(yǔ)言都表達(dá)了軟件的陰陽(yáng)兩極。每種語(yǔ)言都各得其道。 But do not program in COBOL if you can avoid it. 但是盡量不要用COBOL語(yǔ)言。 1.3 In the beginning was the Tao. The Tao gave birth to Space and Time. Therefore, Space and Time are the Yin and Yang of programming. 道之初,帶來了空間和時(shí)間,所以,空間和時(shí)間是編程的陰陽(yáng)兩極。 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 accomplish their goals. 不懂編程之道的程序員常常把空間和時(shí)間消耗殆盡,得道的程序員則總是有足夠的空間和時(shí)間去完成編程任務(wù)。 How could it be otherwise? 否則會(huì)是什么樣呢? 1.4 The wise programmer is told about the Tao and follows it. The average programmer is told about the Tao and searches for it. The foolish programmer is told about the Tao and laughs at it. 上士聞道,從而行之。中士聞道,謹(jǐn)而尋之。下士聞道,大笑之。 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. 希音不聞,進(jìn)即是退,大囂晚成。任何程序都有漏洞。 -------------------------------------------------------------------------------- The Ancient Masters Book Two Thus spake the master programmer: 編程大師如是說: "After three days without programming, life becomes meaningless." 三日不編程,食肉無味。 2.1 The programmers of old were mysterious and profound. We cannot fathom their thoughts, so all we do is describe their appearance. 遠(yuǎn)古時(shí)代的編程大師們高深莫測(cè),我們不能揣測(cè)他們的所思所想,只能描述外表所見。 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. 他達(dá)明,如狐貍過水;機(jī)警,如戰(zhàn)場(chǎng)上的將軍;和善,如主婦款待客人;簡(jiǎn)單,呆若木雞;混沌,如深淵之水。 Who can tell the secrets of their hearts and minds? 誰(shuí)能道盡他們的所有? The answer exists only in the Tao. 答案僅存于道。 2.2 Grand Master Turing once dreamed that he was a machine. When he awoke he exclaimed: 超級(jí)大師圖靈曾夢(mèng)見自己是一臺(tái)機(jī)器,醒后他這樣回憶: "I don‘t know whether I am Turing dreaming that I am a machine, or a machine dreaming that I am Turing!" “我不知道是圖靈夢(mèng)見自己變成機(jī)器還是機(jī)器夢(mèng)見自己變成圖靈。” 2.3 A programmer from a very large computer company went to a software conference and then returned to report to his manager, saying: "What sort of programmers work for other companies? They behaved badly and were unconcerned with appearances. Their hair was long and unkempt and their clothes were wrinkled and old. They crashed out hospitality suites and they made rude noises during my presentation." 一個(gè)大公司的程序員參加一個(gè)軟件會(huì)議后向他的主管匯報(bào):“那些別的公司的程序員都是些什么樣的人呀?他們舉止不雅,不修邊幅,頭發(fā)蓬亂,衣服破舊,根本不熱情好客,還在我說話的時(shí)候亂嚷嚷。” 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?" 他的主管說:“我不應(yīng)該讓你參加這次會(huì)議,這些程序員生活在現(xiàn)實(shí)世界之外。他們認(rèn)為生活是可笑的,一場(chǎng)意外的偶然而已。他們來去自由,無所牽掛,他們只為他們的程序生活。為什么要用世俗的煩擾去擾亂他們呢?” "They are alive within the Tao." “他們生活在道中”。 2.4 A novice asked the Master: "Here is a programmer that never designs, documents, or tests his programs. Yet all who know him consider him one of the best programmers in the world. Why is this?" 一個(gè)初學(xué)者問主管經(jīng)理:“有一個(gè)程序員,他從來不預(yù)先設(shè)計(jì),也不寫文檔,甚至不測(cè)試他的程序,但是知道他的人都認(rèn)為他是世界上最偉大的程序員,為什么呢?” 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." 經(jīng)理說:“那個(gè)程序員掌握了道。他不需要預(yù)先進(jìn)行設(shè)計(jì);系統(tǒng)崩潰時(shí)他也從不煩燥,只是接受發(fā)生的一切而不管發(fā)生的事是好是壞 。他不需要寫文檔,他從不顧及有沒有人看他寫的代碼。他也不需要進(jìn)行測(cè)試;他寫的每個(gè)程序都有一個(gè)完美的自我,平靜而優(yōu)雅,它們的目的不言自明。他已經(jīng)真正掌握了道的精髓。” -------------------------------------------------------------------------------- Design Book Three Thus spake the master programmer: 編程大師如是說: "When program is being tested, it is too late to make design changes." “程序被測(cè)試時(shí)再去改變它的設(shè)計(jì)已經(jīng)太晚了。” 3.1 There once was a man who went to a computer trade show. Each day as he entered, the man told the guard at the door: 曾經(jīng)有一個(gè)人參加計(jì)算機(jī)展覽,每天他進(jìn)門時(shí)都對(duì)門衛(wèi)說: "I am a great thief, renowned for my feats of shoplifting. Be forewarned, for this trade show shall not escape unplundered." “先警告你,我是偷盜高手,我入室偷盜的本領(lǐng)聞名遐邇。這次展覽會(huì)也再劫難逃。” 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. 警衛(wèi)因此大動(dòng)干戈,因?yàn)槔锩嬗袃r(jià)值百萬的計(jì)算機(jī)設(shè)備,所以他牢牢盯緊了這個(gè)人,但是這個(gè)人只是從一個(gè)攤位逛到另一個(gè)攤位,一邊平靜地喃喃自語(yǔ)。 When the man left, the guard took him aside and searched his clothes, but nothing was to be found. 當(dāng)這個(gè)人離開時(shí),警衛(wèi)搜了他的身,但是什么也沒有發(fā)現(xiàn)。 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. 展覽會(huì)的第二天,這個(gè)人又對(duì)警衛(wèi)說:“昨天我滿載而歸,但是今天我會(huì)收獲更大。”所以警衛(wèi)更加小心地盯緊他,但是這樣做完全于事無補(bǔ)。 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?" 展覽會(huì)的最后一天,警衛(wèi)再也不能忍住他的好奇心了。“小偷先生,”他說,“ 你說我驚慌不安,請(qǐng)告訴我,你到底偷了什么?”。 The man smiled. "I am stealing ideas," he said. 這個(gè)人笑笑說:“我在偷想法。” 3.2 There once was a master programmer who wrote unstructured programs. A novice programmer, seeking to imitate him, also began to write unstructured programs. When the novice asked the master to evaluate his progress, the master criticized him for writing unstructured programs, saying: "What is appropriate for the master is not appropriate for the novice. You must understand the Tao before transcending structure." 有一位編程大師,他寫非結(jié)構(gòu)化的程序,一位初學(xué)者刻意模仿他,也寫非結(jié)構(gòu)化的程序。當(dāng)他讓大師看他的進(jìn)步時(shí),大師批評(píng)了他的非結(jié)構(gòu)化程序:“ 對(duì)一位編程大師合適的東西未必對(duì)一個(gè)初學(xué)者同樣合適,在超越結(jié)構(gòu)化之前,你必須理解編程之道。” 3.3 There was once a programmer who was attached to the court of the warlord of Wu. The warlord asked the programmer: "Which is easier to design: an accounting package or an operating system?" ###有人問一位程序員,“一個(gè)財(cái)務(wù)軟件和一個(gè)操作系統(tǒng)哪個(gè)更容易設(shè)計(jì)?” "An operating system," replied the programmer. “是操作系統(tǒng)”,這位程序員回答說。 The warlord uttered an exclamation of disbelief. "Surely an accounting package is trivial next to the complexity of an operating system," he said. 此人大惑不解。他說:“顯然一個(gè)財(cái)務(wù)軟件比起操作系統(tǒng)來說其復(fù)雜性是微不足道的”。 "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." 程序員說:“不,設(shè)計(jì)財(cái)務(wù)軟件時(shí),一個(gè)程序員必須成為持不同意見的用戶與計(jì)算機(jī)的一個(gè)中介,他必須了解用戶的操作習(xí)慣,報(bào)表要是什么形式,如何遵循稅法。相反,一個(gè)操作系統(tǒng)完全與這些外部的東西無關(guān)。設(shè)計(jì)操作系統(tǒng),程序員只需要達(dá)到自己的設(shè)想與機(jī)器之間的簡(jiǎn)單的和諧。這就是為什么操作系統(tǒng)反而比財(cái)務(wù)軟件更容易設(shè)計(jì)。” The warlord of Wu nodded and smiled. "That is all good and well, but which is easier to debug?" 這些人笑著說。“不錯(cuò),但是哪一個(gè)更容易調(diào)試呢?” The programmer made no reply. 程序員沒有回答。 3.4 A manager went to the master programmer and showed him the requirements document for a new application. The manager asked the master: "How long will it take to design this system if I assign five programmers to it?" 一個(gè)項(xiàng)目經(jīng)理帶給編程大師一個(gè)項(xiàng)目的需求,然后問大師:“如果我給你5個(gè)程序員,要多少時(shí)間設(shè)計(jì)這個(gè)項(xiàng)目?” "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?" “但是我們等不了那么長(zhǎng)時(shí)間,越快越好,如果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. 大師聳了聳肩說:“那這個(gè)項(xiàng)目就永遠(yuǎn)完不成了。” -------------------------------------------------------------------------------- Coding Book Four Thus spake the master programmer: 編程大師如是說: "A well-written program is its own heaven; a poorly-written program is its own hell." “寫的好的程序是它自己的天堂,寫的不好的程序是它自己的地獄” 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. 一個(gè)程序應(yīng)該是輕靈自由的,它的子過程就象串在一根線上的珍珠。自始至終,目標(biāo)明確。增之一字節(jié)則太長(zhǎng),減之一字節(jié)則太短。既沒有不必要的循環(huán)也沒有沒有被引用的變量,既不缺少結(jié)構(gòu)化也不至于僵硬呆板。 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. 一個(gè)程序應(yīng)該遵循"最小驚訝原則‘‘,什么是"最小驚訝原則‘‘?就是說一個(gè)程序應(yīng)該最小程度地引起用戶的驚訝。 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. 無論一個(gè)程序無論有多么復(fù)雜都應(yīng)該是一個(gè)單一的整體。程序是被它的內(nèi)部邏輯所指引而不是它的外觀表現(xiàn)。 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. 如果一個(gè)程序不能滿足所要的需求,它就會(huì)處于混亂無序的狀態(tài)中。唯一的出路就是重寫這個(gè)程序。 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?" 一個(gè)初學(xué)者問大師:“我的一個(gè)程序有時(shí)正常有時(shí)不正常。我已經(jīng)完全遵循編程的規(guī)則,而且我完全被它弄糊涂了,到底是什么原因會(huì)導(dǎo)致這樣呢?” 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. 大師說:“你困惑是因?yàn)槟悴涣私獾?。只有傻瓜才?huì)相信只要遵循別人所說就能得到想當(dāng)然的結(jié)果。為什么你要從一個(gè)人類自己構(gòu)造的機(jī)器中去得到想當(dāng)然的結(jié)果呢?計(jì)算機(jī)只是決定論的產(chǎn)物;只有道才是唯一完美的。 The rules of programming are transitory; only the Tao is eternal. Therefore you must contemplate the Tao before you receive enlightenment. 任何編程的規(guī)則都只適合于特定的情況,只有道才是永恒不變的。所以在你受到指引之前要先去思考道。 "But how will I know when I have received enlightenment?" asked the novice. “但是我怎么知道我何時(shí)受到指引呢?” "Your program will then run correctly," replied the master. “當(dāng)你的程序正確運(yùn)行時(shí)”。大師說。 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. 初學(xué)者請(qǐng)大師解釋“道法自然”。大師說:“道存在于任何軟件中--無論是多么沒有意義的軟件”。 "Is the Tao in a hand-held calculator?" asked the novice. “難道也存在于手持式的計(jì)算囂里?”,初學(xué)者問。 "It is," came the reply. “是的,” "Is the Tao in a video game?" continued the novice. “也在游戲機(jī)里?”,初學(xué)者又問到。 "It is even in a video game," said the master. “是的,甚至也存在于游戲機(jī)里”。大師說。 "And is the Tao in the DOS for a personal computer?" “也存在于個(gè)人計(jì)算機(jī)的DOS里嗎?” The master coughed and shifted his position slightly. "The lesson is over for today," he said. 大師咳嗽了一聲,稍微動(dòng)了一下,說,“今天的課就到這里”。 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. ###編程大師編寫軟件時(shí),手指在鍵盤上快速飛舞。程序編譯時(shí)沒有一條錯(cuò)誤信息,程序運(yùn)行起來就象一陣微風(fēng)吹過。 Excellent!" the Price exclaimed, "Your technique is faultless!" 太精彩了!你的技巧已經(jīng)無可挑剔了。 "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." “技巧?”,大師轉(zhuǎn)過身說,“我所遵循的是道--它超乎所有的技巧。當(dāng)我開始編程時(shí)我看到的是整個(gè)一大塊的程序,三年后我看到的是子過程?,F(xiàn)在我什么也看不到了。我的整個(gè)存在是沒有任何形式的虛無。我感覺很悠閑,總之,事實(shí)上是我的程序自己在寫,有時(shí)我看到一些問題,我看到它們,就停下來靜靜地觀察它們,然后我改變了一行代碼,難題就象一陣輕煙一樣化為烏有。然后我編譯程序。坐在那里享受工作的喜悅。閉了一會(huì)眼睛然后退出系統(tǒng)。 Price Wang said, "Would that all of my programmers were as wise!" “什么時(shí)候我的程序員才能都達(dá)到這樣的境界!” Mainteance Book Five Thus spake the master programmer: 編程大師如是說: "Though a program be but three lines long, someday it will have to be maintained." “既使一個(gè)程序只有三行長(zhǎng),也總有一天需要去維護(hù)它” 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. 經(jīng)常使用的門不需要往門軸里上油。 流動(dòng)的東西就不會(huì)停滯不前。 流水不腐,戶樞不蠹。--王磊 聲音和思想都不能在真空里傳播。 軟件不用就會(huì)腐朽。 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. 經(jīng)理問程序員要多長(zhǎng)時(shí)間才能完成他的項(xiàng)目。“明天” "I think you are being unrealistic," said the manager. "Truthfully, how long will it take?" “太不著邊際了,老實(shí)說,要多久?” 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. 程序員想了一想說。“還有一些新的功能要加進(jìn)去,可能至少要兩個(gè)星期吧。” "Even that is too much to expect," insisted the manager, "I will be satisfied if you simply tell me when the program is complete." “即使兩個(gè)星期恐怕也太夸張了,什么時(shí)候你只要告訴我說程序已經(jīng)完成就好了。” 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. 幾年后,這個(gè)經(jīng)理已經(jīng)退休了,在他的離職午餐上,他發(fā)現(xiàn)這些程序員在他的終端前睡著了,他整夜都在編程。 5.3 A novice programmer was once assigned to code a simple financial package. 一個(gè)初學(xué)者被要求編寫一個(gè)財(cái)務(wù)軟件。 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. 他瘋狂地工作了很多天,但他的主管檢視他的程序時(shí)發(fā)現(xiàn),它寫了一個(gè)編輯囂,一個(gè)圖形程序集,和人工智能的界面,但是看不到任何跟財(cái)務(wù)有關(guān)的東西。 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." 主管要求解釋時(shí),程序員被激怒了:“你太沒耐心了,我會(huì)在最后寫財(cái)務(wù)的部分。” 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? 一個(gè)好的農(nóng)民不會(huì)不管他的莊稼。 一個(gè)好的老師不會(huì)不管哪怕是最差的學(xué)生。 一個(gè)好的父親不會(huì)讓他的任何一個(gè)孩子挨餓。 一個(gè)好的程序員不應(yīng)拒絕維護(hù)他的程序。 -------------------------------------------------------------------------------- Management Book Six Thus spake the master programmer: 編程大師如是說: "Let the programmer be many and the managers few -- then all will be productive." “增加程序員,減少經(jīng)理--這樣他們都可提高效率。” 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. 經(jīng)理們忙于無休無止的會(huì)議時(shí),程序員們?cè)趯懹螒?。?cái)務(wù)主管在談?wù)摷径扔麜r(shí)開發(fā)預(yù)算將會(huì)被削減。當(dāng)老科學(xué)家在談天空的藍(lán)色時(shí),云團(tuán)蜂擁而至。 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. 經(jīng)理分配任務(wù)時(shí)不會(huì)包括游戲,會(huì)計(jì)師做長(zhǎng)期計(jì)劃時(shí),應(yīng)該做到面面俱到,皆大歡喜??茖W(xué)家提出一個(gè)問題,就會(huì)很快得到解決。 Truly, this is the Tao of Programming. 這才是編程之道。 6.2 Why are programmers non-productive? Because their time is wasted in meetings. 為什么程序員沒有效率,因?yàn)樗麄儼褧r(shí)間都浪費(fèi)在開會(huì)上了。 Why are programmers rebellious? Because the management interferes too much. 為什么程序員難于管理?因?yàn)楣芾碚叩母深A(yù)太多了。 Why are the programmers resigning one by one? Because they are burnt out. 為什么程序員一個(gè)接一個(gè)地辭職,因?yàn)樗麄兝蹓牧恕? 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. 一個(gè)經(jīng)理將被解雇,但他手下的一個(gè)程序員寫了一個(gè)流行的軟件并且銷路很旺。所以經(jīng)理保住了他的工作。 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." 經(jīng)理為程序員分紅,但程序員拒絕了,他說:“我寫程序是因?yàn)閷懗绦蚝苡腥ぃ晕也]想過得資金”。 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!" 這位經(jīng)理說,“這位程序員,不管他現(xiàn)在是什么位置,他都能理解一個(gè)雇員的職責(zé)所在。我們要把他提升為管理顧問”。 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." 這位程序員又一次拒絕了,他說:“我是一個(gè)程序員所以我可以編程,如果我被提升了,除了浪費(fèi)別人的時(shí)間什么也做不了,現(xiàn)在我可以走了嗎?我還有一個(gè)程序沒寫完。” 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. 經(jīng)理對(duì)程序員說,“你們的工作時(shí)間是早上9點(diǎn)到正午點(diǎn)。”,所有的程序員都很不滿。 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. 經(jīng)理又說:“好吧,那隨你們的便,只要能按時(shí)完成任務(wù)。”,程序員們這下滿意了,他們中午上班,一直工作到凌晨。 -------------------------------------------------------------------------------- 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." ### “你可以向一位公司主管演示一套程序,但你不能讓他的電腦變得象人一樣。” 7.1 A novice asked the master: "In the east there is a great tree-structure that men call ‘Corporate Headquarters‘. It is bloated out of shape with vice-presidents and accountants. It issues a multitude of memos, each saying ‘Go, Hence!‘ or ‘Go, Hither!‘ and nobody knows what is meant. Every year new names are put onto the branches, but all to no avail. How can such an unnatural entity exist?" 一個(gè)新學(xué)問大師:“在東方,有一個(gè)龐大的機(jī)構(gòu),人們稱作總部。它由為數(shù)眾多的大小領(lǐng)導(dǎo)。每天發(fā)出大量的備忘錄,每個(gè)備忘錄都說:‘干這個(gè),干那個(gè)’,沒有一個(gè)人知道它是什么意思。每年這個(gè)機(jī)構(gòu)都會(huì)有更多的人加進(jìn)來而變得越來越大,但是去沒有人去做事情。怎么燴樣奇怪的東西還能存在呢?” 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?" 大師說:“你已經(jīng)知道這個(gè)巨大的機(jī)構(gòu)并不合理,你就不能不管它為什么這樣嗎?你盡管享受它的好處就是了,干嗎要去管它到底是沒有效率呢?” 7.2 In the east there is a shark which is larger than all other fish. It changes into a bird whose winds are like clouds filling the sky. When this bird moves across the land, it brings a message from Corporate Headquarters. This message it drops into the midst of the program- mers, like a seagull making its mark upon the beach. Then the bird mounts on the wind and, with the blue sky at its back, returns home. 在遙遠(yuǎn)的東方,傳說有一只巨大的魚,叫鯤,它變成了一只大鳥,叫鵬,鵬的翅膀可以遮天蔽日,這只大鳥經(jīng)過陸地的時(shí)候,它帶來了一個(gè)消息,它把這個(gè)消息丟在程序員中,就象一只海鷗在海灘上做的記號(hào),然后鵬背負(fù)藍(lán)天,乘風(fēng)而上,回家去了。 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. 初學(xué)者驚恐地看著這只鳥,根本不敢相信,中級(jí)程序員擔(dān)心這只鳥的到來,因?yàn)樗ε滤鼛淼南?,編程大師則繼續(xù)在他的終端前工作他根本不知道這只鳥曾經(jīng)來過。 7.3 The Magician of the Ivory Tower brought his latest invention for the master programmer to examine. The magician wheeled a large black box into the master‘s office while the master waited in silence. 一個(gè)學(xué)究帶著他的最新發(fā)明去見編程大師,他把一個(gè)大黑盒子推進(jìn)大師的辦公室。 "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?" “這是綜合的、分布式的通用工作站,”,學(xué)究開始介紹了,“按人體工學(xué)設(shè)計(jì)的操作系統(tǒng),第六代的高級(jí)語(yǔ)言,多樣的用戶界面,整整花了我的助手好幾百人年的時(shí)間,挺不錯(cuò)吧?” The master raised his eyebrows slightly. "It is indeed amazing," he said. 大師揚(yáng)了一下眉毛,說:“的確很了不起。” "Corporate Headquarters has commanded," continued the magician, "that everyone use this workstation as a platform for new programs. Do you agree to this?" “頭兒已經(jīng)說了,”這位學(xué)究繼續(xù)說,“每個(gè)人都要用這個(gè)工作站作平臺(tái),你覺得怎么樣?” "Certainly," replied the master, "I will have it transported to the data center immediately!" And the magician returned to his tower, well pleased. “當(dāng)然了,”,大師回答說,“我要馬上把它送到數(shù)據(jù)中心去!”,這位學(xué)究滿意去回去了。 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?" 幾天后,一個(gè)新手走進(jìn)大師的辦公室說,“我找不到我新寫的程序了,你知道它可能會(huì)在哪兒?jiǎn)幔?#8221; "Yes," replied the master, "the listings are stacked on the platform in the data center." “當(dāng)然,”,大師說,“你的程序在數(shù)據(jù)中心的平臺(tái)里放著。” 7.4 The master programmer moves from program to program without fear. No change in management can harm him. He will not be fired, even if the project is canceled. Why is this? He is filled with the Tao. 編程大師從一個(gè)項(xiàng)目轉(zhuǎn)到另一個(gè)項(xiàng)目而豪無顧慮,任何管理上的變動(dòng)都不能影響他,他不會(huì)被解雇,即使項(xiàng)目被取消了。為什么呢?他了解了道。 -------------------------------------------------------------------------------- Hardware and Software Book Eight Thus spake the master programmer: "Without the wind, the grass does not move. Without software, hardware is useless." 風(fēng)不動(dòng)則草不動(dòng), 沒有軟件,硬件只是一堆發(fā)熱的電子器件 8.1 A novice asked the master: "I perceive that one computer company is much larger than all others. It towers above its competition like a giant among dwarfs. Any one of its divisions could comprise an entire business. Why is this so?" 一個(gè)初學(xué)者問編程大師:“我知道有一家計(jì)算機(jī)公司比所有其它的公司都大。在它面前它的競(jìng)爭(zhēng)對(duì)手就象站在巨人面前的侏儒。它的任一部門都有各自的業(yè)務(wù),為什么會(huì)這樣呢?” 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." 大師說,“為什么你問如此愚蠢的問題呢?那家公司大是因?yàn)樗褪侨绱酥?,如果它只做硬件,就沒有人會(huì)買,如果它只維護(hù)系統(tǒng),人們只會(huì)把它當(dāng)作仆人,但是它的業(yè)務(wù)囊括了所有這些東西,人們就對(duì)它頂禮莫拜好象不用努力奮斗就可擊敗競(jìng)爭(zhēng)對(duì)手。" 8.2 A master programmer passed a novice programmer one day. The master noted the novice‘s preoccupation with a hand-held computer game. "Excuse me", he said, "may I examine it?" 有一天編程大師碰見了一個(gè)正玩掌上游戲機(jī)的編程新手,他說:“給我看一下?” 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." 新手把游戲機(jī)遞給大師,“我看到上面說明了三種難度的玩法:容易,中等,高難”,大師說,“但是每個(gè)這樣的游戲機(jī)都有另外一種玩法,此時(shí)游戲機(jī)即不是想著怎么贏你,也不是怎么被你贏。” "Pray, great master," implored the novice, "how does one find this mysterious setting?" “那么請(qǐng)問大師”,初學(xué)者說,“這種玩法到底是怎樣玩的呢?” The master dropped the device to the ground and crushed it under foot. And suddenly the novice was enlightened. 大師把游戲機(jī)摔到地下然后用腳踩碎它,突然初學(xué)者明白了。 8.3 There was once a programmer who worked upon microprocessors. "Look at how well off I am here," he said to a mainframe programmer who came to visit, "I have my own operating system and file storage device. I do not have to share my resources with anyone. The software is self-consistent and easy-to-use. Why do you not quit your present job and join me here?" 有一個(gè)工作在微機(jī)上的程序員對(duì)前來參觀的大型機(jī)程序員說:“看看我這里吧,我有自己的操作系統(tǒng)和文件存儲(chǔ)設(shè)備,我不需要與別人共享任何資源,軟件條條有理并且易于操作。為什么你不辭去你的工作到這里來呢?” 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." 大型機(jī)的程序員對(duì)他的朋友說:“大型機(jī)就象古代圣賢一樣深思熟慮,它的磁盤設(shè)備從頭到尾就象是一個(gè)巨大的機(jī)械設(shè)備的海洋。軟件象鉆石一樣有多個(gè)面,象遠(yuǎn)古的森林一樣令人費(fèi)解。每一個(gè)程序都象水經(jīng)過河流一樣穿行于系統(tǒng)中,那就是為什么我樂于為它工作” The microcomputer programmer, upon hearing this, fell silent. But the two programmers remained friends until the end of their days. 微機(jī)程序員聽了這些話后,默默不語(yǔ),但這兩個(gè)程序員至死都是很好的朋友 8.4 Hardware met Software on the road to Changtse. Software said: "You are the Yin and I am the Yang. If we travel together we will become famous and earn vast sums of money." And so the pair set forth together, thinking to conquer the world. 硬件和軟件在路上碰見了,軟件說:“你是陰我是陽(yáng),如果我們聯(lián)手就可以賺大錢。”所以它們走到了一直,考慮怎樣征服世界。 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." 不久,它們遇到了固件,固件衣衫襤褸,拄著一根拐棍步履蹣跚。固件對(duì)它們說:“道在于陰陽(yáng)之外。它靜如止水,它從不指望能揚(yáng)名遠(yuǎn)近,所以沒有人知道它的存在。它也不尋求幸福,它只是與它自己的存在在一起,它存在于空間和時(shí)間之外。” Software and Hardware, ashamed, returned to their homes. 軟件和硬件面有慚色,各自回了家。 Epilogue Book Nine Thus spake the master programmer: 編程大師如是說: "Time for you to leave." “現(xiàn)在是你出師的時(shí)候了。” |
|