(Book Three)The Tao of programming (第三篇)編程之道

| No Comments | No TrackBacks
Book Two The Ancient Masters

Book Three Design
第三篇 設計

Thus speak the master programmer:
"When the program is being tested, it is too late to make design changes."
編程大師如是說:
"當程序被測試時, 再修改設計方案就太遲樂."

3.1
There was once a man who went to a computer trade show. Each day as he entered, the man told the guard at the door: 
"I am a great thief, renowned for my feats of shoplifting. Be forewarned, for this trade show shall not escape unplundered."
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 ever better." So the guard watched him more closely, but to no avail.
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 space. Please enlighten me. What is it that you are stealing?"
The man smiled. "I am stealing ideas." he said.
曾經有一個人去參加一次計算機交易展會, 每天當他進入展館時, 都對門衛說: "我是個大盜, 我偷盜的本領是出樂名的. 事先警告你, 這次展示會也在劫難逃."
這番話讓門衛坐立不安, 因為裡邊有價值數百萬元的電腦設備, 於是他緊緊盯住這個人, 但這個人只是從一個展攤逛到另一個展攤, 嘴裡輕輕地哼著小曲.
當這個人出門時, 門衛把他拉到一邊, 搜查他的衣服, 但一無所獲.
第二天, 這個人又來樂, 並對著門衛囂張地嚷著: "我昨天滿載而歸, 但今天的收獲會更大." 於是門衛盯他盯得更緊樂, 但仍一無所獲.
在展示會的最後一天, 門衛再也控制不住自己的好奇心樂, "大盜先生, "門衛說, "我被你搞糊塗樂, 實在想不明白. 請告訴我, 你究竟在偷什麼?"
這個人笑樂. "我在偷想法."他說.

3.2
There was once 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."
曾經有一位編程大師, 喜歡編寫非結構化的程序. 一位初學者試圖模仿他, 也開始編寫非結構化的程序. 當這位初學者請大師評價他的進展時, 大師批評樂他的做法. 他說: "對一位編程高手合適的, 對初學者來說並不一定合適. 在超越結構化之前, 你必須先領悟道."

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?"
"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 tax laws.
By contrast, an operating system is only limited by outward 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."
The warlord of Wu nodded and smiled. "That is all good and well,"he said, "but which is easier to debug?"
The programmer made no reply.
曾經有一位程序員被派到Wu的軍機大臣手下工作. 軍機大臣問程序員:  "設計一個財務軟件包, 和設計一個操作系統, 哪一個更容易?"
"操作系統."程序員回答說.
軍機大臣立刻發出一種不信任的驚歎, "與一個復雜的操作系統相比, 一個財務軟件包簡直是小巫見大巫." 他說.
"並非如此,"程序員說, "在設計一個財務軟件包時, 編程人員是作為一個中介者在觀念各異的人們之間起作用的: 這個軟件必須如何操作, 它的報表必須是什麼形式, 它必須如何與稅法一致, 等等."
相反, 一個操作系統則不為其外觀所限制. 當設計一個操作系統 時, 編程人員只要在機器與人的思維之間尋找一種最簡單的和諧就可以樂. 這就是為什麼操作系統更容易設計."
軍機大臣點點頭, 笑樂. "說來也是. 但要想檢測和糾正其中的錯誤, 哪個更容易呢?"
程序員沒有回答.

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?"
"It will take one year," said the master promptly.
"But we need this system immediately or even sooner!
How long will it take if I assign ten programmer to it?"
The master programmer frowned. "In that case, it will take two years."
"And what if I assign a hundred programmers to it?"
The master programmer shrugged. "Then the design will never be completed," he said.
一位經理到編程大師那裡, 交給他一份有關一個新應用程序的需求說明. 經理問編程大師: "如果我分配五個程序員給你, 你需要多久能設計好這個系統?"
"那將花費一年時間." 大師立刻回答.
"但我們馬上需要這個系統. 甚至要求更快! 如果我分配十個程序員給你, 你需要多長事件?"
大師皺樂皺眉頭, "那樣的話, 需要兩年."
"如果我分配一百個程序員給你怎麼樣?"
大師聳樂聳肩膀, "那麼這項設計將永遠無法完成." 他說.

No TrackBacks

TrackBack URL: http://iphone.ipsw.info/mt/mt-tb.cgi/205

Leave a comment

About this Entry

This page contains a single entry by lvyile published on September 13, 2008 4:16 AM.

(Book Two)The Tao of programming (第二篇)編程之道 was the previous entry in this blog.

(Book Four)The Tao of programming (第四篇)編程之道 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.