编程之道

来源:互联网 发布:索尼网络电视怎样打开 编辑:程序博客网 时间:2024/05/10 12:14

The Tao Of Programming

Translated By
Geoffrey James

编程之道

Geoffrey James
翻译:flyingapplet

Table of Contents

Book 1 -- The Silent Void
Book2 -- The Ancient Masters
Book 3 -- Design
Book 4 -- Coding
Book 5 -- Maintenance
Book 6 -- Management
Book 7 -- Corporate Wisdom
Book 8 -- Hardware and Software
Book 9 -- Epilogue

目录

卷一 —— 宁静的虚无
卷二 —— 远古的大师
卷三 —— 设计
卷四 —— 编码
卷五 —— 维护
卷六 —— 管理
卷七 —— 公司智慧
卷八 —— 硬件和软件
卷九 —— 后记

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."

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 great, then the application is great. The user is pleased and their is harmony in the world.

The Tao of Programming flows far away and returns on the wind of morning.

1.2

The Tao gave birth to machine language. Machine language gave birth to the assembler.

The assembler gave birth to the compiler. Now their 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.

1.3

In the beginning was the Tao. The Tao gave birth to Space and Time. Therefore Space and Time are Yin and Yang of programming.

Programmers that do not comprehend the Tao are always running out of time and space for there programs. Programmers that comprehend the Tao always have enough time and space to accomplish their goals.

How could it be otherwise?

1.4

The wise programmer is told about Tao and follows it. The average programmer is told about Tao and searches for it. The foolish programmer is told about Tao and laughs at is.

If it were not for laughter, there would be no Tao.

The highest sounds are hardest to hear. Going forward is a way to retreat. Great talent shows itself late in life. Even a perfect program still has bugs.

卷一 宁静的虚无

编程大师如是说:“当你学会了从调用栈中抓取错误码的时候就可以出师了。”

1.1

宁静的虚无中诞生了一个神秘的东西。它既瞬间静止又时刻在运动,在那里静静地独自等待。他是所有程序之源。我不知道它的名字,就称之为编程之道。

如果道是伟大的,那么操作系统就是伟大的。如果操作系统是伟大的,那么编译器就是伟大的。如果编译器是伟大的,那么应用就是伟大的。用户满意了,世界达到和谐。

编程之道飘向远方,又随着清晨的微风回归。

1.2

道生机器语言。机器语言生汇编语言。

汇编语言生编译器。于是有了数以万计的语言。

每个语言都有它的作用,不论是大是小。每个语言都表达软件的阴与阳。每个语言都在道中有一席之地。

但是不到万不得已不要用COBOL写程序。

1.3

混沌之初有道。道产生了空间和时间。于是空间和时间就是编程的阴与阳。

不懂得道的程序员写的程序总是在时间和空间上不能满足要求。懂得道的程序要总是有足够的时间和空间来达到他们的目标。

难道不是这样吗?

1.4

智慧的程序员听了道之后追随它。普通的程序员听了道之后搜寻它。愚蠢的程序员听了道之后笑话它。

没有笑声就没有道。

最高亢的声音也最难听到。前进也是一种后退。大智慧往往在很晚的时候才显现出来。完美的程序也有bug。

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.

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 Tao.

2.2

Grand Master Turing once dreamed that he was a machine. When he awoke he exclaimed:

"I don't know whether I am Turing dreaming that I am a machine, or a machine dreaming that I am Turing!."

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. There hair was long and unkept and their clothes were wrinkled and old. They crashed out hospitality suite and they made rude noises during my presentation."

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."

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 programmer in the world. Why is this?"

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 Tao."

卷二 远古的大师

编程大师如是说:“三天不写程序,生命变得毫无意义。”

2.1

古老的程序员神秘而又深奥。我们无法理解他们的思想,所以只能描述他们的外表。

洞察——像正在过河的狐狸一样。警觉——像战场上的将军一样。亲切——像招呼客人的主人一样。简单——像一块未经雕琢的木头一样。晦涩——像黑暗洞穴里的一潭黑水一样。

谁能说出他们心灵和思想中的秘密?

只有道能给出答案。

2.2

特级大师图灵曾经梦到自己是台机器。醒来后他说道: “我不知道自己是图灵做梦变成了机器,还是机器做梦变成了图灵。”

2.3

某个很大的计算机公司的程序员参加了一个软件会议,回来跟他的经理汇报说:“别的公司的那些程序员是些什么人?他们举止不文明而且一点都不在乎仪表。他们的头发长又乱糟糟的,衣服又皱又旧。他们在接待室过夜,在我演讲的时候还粗鲁地弄出噪音。”

经理说:“我不应该送你去参加那个会议。那些程序员生活在物理世界之外。他们认为生活是荒谬的,只不过是无逻辑的巧合。他们来来去去,不理会条条框框。他们只为他们的程序而生,对别的毫不关心。他们怎么会在意世俗礼仪呢?

他们生活在道中。”

2.4

新手问大师:“那个程序员编程时从来不做设计,不写文档,也不做测试。然而所有知道他的人都认为他是世界上最好的程序员之一。为什么呢?”

大师答:“那个程序员已经精通了道。他已经超越了需要做设计的境界;系统崩溃的时候他一点都不生气。他已经超越了需要写文档的境界;他不再关心是否有别人读他的代码。他已经超越的需要测试的境界;他的每个程序都是完美的个体,安详而优美,功能不言自明。真的,他已经进入道的神秘之中。

Design
Book Three

Thus spake the Master Programmer:
"When the program is being tested, it is too late to make design changes."

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:

"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 even better." So the guard watched him ever 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 peace. Please enlighten me. What is it that you are stealing?"

The man smiled. "I am stealing ideas," he said.

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 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 the tax laws. By contrast, an operating system is not limited by 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."

The warlord of Wu nodded and smiled. "That is all good and well, but which is easier to debug?"

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?"

"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 programmers 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.

卷三 设计

编程大师说:“程序进入测试阶段后再改变设计就晚了。”

3.1

曾经有个人去参加计算机展销会。每天进入会场的时候,他都跟门口的保安说: “我是个神偷,以入店行窃技巧高超而名闻遐迩。听好了,这次展销会逃不出我的手掌心。”

这番言论令保安深感不安,因为展销会上有数百万美元的计算机设备,于是他一丝不苟地盯着那个人。可是那个人只是从一个展台晃悠到另一个站台,一副自得其乐的样子。

他离场的时候,保安把它拉到一边里里外外搜了个遍,没发现任何东西。

展销会第二天那个人又来了,还指责保安说:“昨天我成功地带走了大量战利品,但今天我要捞更多。”于是保安寸步不离地盯着他,但没发现任何蛛丝马迹。

展销会的最后一点保安再也按耐不住了。“小偷先生”,他说,“我太困惑了,生活在苦恼之中。请您点拨我。你到底在偷什么?”

那个人笑道:“我在偷想法。”

3.2

以前有个编程大师常写非结构化的程序。一个新手程序员想模仿他,也开始写非结构化的程序。当新手请大师来评价他的进展的时候,大师批评他写的程序不是结构化的。大师说“适合于大师的不一定适合于新手。你必须理解了道才能超越结构。”

3.3

曾经有个程序员就职于吴王的宫廷。吴王问程序员:“财务软件包和操作系统哪个更容易设计?”

“操作系统。”程序员回答。

吴王发出难以置信的惊呼。“跟操作系统的复杂程度相比,财务软件包当然微不足道了。”,他说。

“非也”,程序员说,“设计财务软件包的时候,程序员在一群持不同意见的人中扮演调解人的角色:软件应该怎么操作,报表是什么样子,如何遵循税法等等。相比之下,操作系统不受外部表象的限制。设计操作系统的时候,程序员寻求机器和想法之间的最简单的和谐。这就是为什么操作系统更容易设计。”

吴王点头微笑,“你说的都对,但哪个更容易调试?”

程序员无语。

3.4

一个经理来到编程大师面前给他看新应用的需求。经理问大师:“如果分配五个程序员,设计这个系统需要多长时间?”

“需要一年”,大师快速答道。

“可是我们马上就需要这个系统,越快越好!如果分配十个程序员需要多长时间?”

大师皱起眉头,“那样的话需要两年。”

“如果我分配一百个程序员呢?”

大师耸耸肩。“那样永远无法完成设计”,他说。

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 string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or 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 sometime 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 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 Tao is prefect.

The rules of programming are transitory; only Tao is eternal. Therefore you must contemplate 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 Tao of 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?"

The master coughed and shifted his position slightly. "The lesson is over for today," he said.

4.4

Prince 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 Prince exclaimed, "Your technique is faultless!"

"Technique?" said the programmer turning from his terminal, "What I follow is Tao -- beyond all techniques! When I first began to program I would see before me the whole problem 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 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."

Prince Wang said, "Would that all of my programmers were as wise!"

卷四 编码

编程大师说:“写得好的程序自身就是天堂,写得差的程序自身就是地狱。”

4.1

程序应该是容易理解的轻巧的,它的子程序象一串珍珠一样连接起来。程序的精神和意图应该始终保持一致。东西既不能太少也不能太多,既不能有无用的循环也不能有无用的变量,既不能缺少结构也不能过度僵化。

程序应该遵循“最少意外定律”。这个定律是什么意思呢?简单说就是程序应该以最不让用户感到意外的方式响应用户。

无论多么复杂的程序都应该向一个单元一样发挥作用。程序应该受内在逻辑而不是外部表象制约。

不能满足这些需求的程序将会处于无序和混乱的状态。改正它的唯一办法就是重写程序。

4.2

新手问大师:“我有一个程序有时候运行正常有时候异常终止。我遵循了编程原则,但还是无法解决。这是什么原因呢?”

大师答道:“你困惑是因为没有理解道。傻瓜才会期望人类的行为总是理性的。你为什么要期待由人制造的机器始终理性呢?计算机只不过是模拟确定性;只有道是完美的。

编程原则是随时间变化的;只有道是永恒的。因此你必须苦思冥想道才能顿悟。”

“那我怎么知道我得到顿悟了呢?”新手问道。

“当你的程序正确运行的时候。”,大师答。

4.3

大师给新手解释道的性质,“道蕴藏于所有软件中——不论价值大小”,大师说。

“手持计算器中有道吗?”,新手问。

“是的”,大师答。

“视频游戏中有道吗?”,新手继续问。

“它也在视频游戏中”,大师说。

“那么个人计算机DOS系统中有道吗?”

大师一阵咳嗽,不安地挪了一下屁股。“今天的课就到这儿”,他说。

4.4

王子的程序员正在写代码。他的手指在键盘上上下飞舞。程序编译没有一个错误,运行起来象一阵清风一样。

“太厉害了!”,王子感叹道,“你的技巧完美无缺!”

“技巧?”,程序员从终端前转过身来说,“我遵循的是道——超越了所有技巧!当我刚开始编程的时候,眼前看到的是一大块整个程序。三年后我看到的不是大块东西,而是一个个子程序。但现在我眼前空无一物。我的整个人处在无形的虚无中,感官停止了工作。我的灵魂随着本能的指引,不受任何计划的约束。长话短说,程序自己就写出来了。没错,有时候会碰到困难的问题。我看到这些问题后就放慢节奏静静地观察。然后只改动一行代码困难就象一阵轻烟一样消失了。然后我开始编译,静静地坐着,让工作的快乐填充我的身体。我闭上眼睛享受一会儿,然后退出登录。”

王子说,“但愿我的程序员都能有这样的智慧!”

Maintenance
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 stream does not 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 later, 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 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, an 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 in the financial stuff 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?

卷五 维护

编程大师如是说:“就算一个程序只有三行,将来某一天也要有人维护它。”

5.1

户枢不蠹。 流水不腐。 声音和思想不能在真空中传播。 没人用的软件会烂掉。

这些都是难解之谜。

5.2

经理问程序员要多久能够完成正在写的程序。“我明天就能完成”,程序员不假思索地回答。

“我觉得这不现实”,经理说,“说真的,需要多长时间?”

程序员想了一会儿。“还有一些功能我想添加。至少需要两个星期。”,他最终说道。

“这样还是期望太高”,经理坚持说,“程序完成的时候告诉我一声我就满足了。”

程序员表示同意。

若干年后,经理退休了。在去退休午餐宴的路上,他发现那个程序员在终端前面睡着了,刚刚工作了个通宵。

5.3

一个新手程序员有次被分配编写一个简单的财务软件包。

新手疯狂工作的很多天,当大师检查他的程序的时候发现其中包含一个屏幕编辑器,一组通用图形函数,一个人工智能接口,但没有任何跟财务相关的东西。

当大师问起来的时候,程序员显得很愤慨。“不要这么着急”,他说,“我最后会加入财务的东西。”

5.4

好农夫会忽视他种下的任何一片庄稼吗? 好老师会放弃哪怕最后进的学生吗? 好父亲会让任何一个孩子挨饿吗? 好程序员会拒绝维护他的代码吗?

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 to 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 tries to give the programmer a bonus, but the programmer refused it, saying, "I wrote the program because I thought 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 on."

6.4

A manager 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."

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 at noon and work to the wee hours of the morning.

卷六 管理

编程大师如是说:“多一些程序员,少一些经理——这样所有人都更有效率。”

6.1

当经理无穷无尽地开会的时候,程序员在写游戏。当财务讨论季度利润的时候,开发预算就要被削减。当资深科学家讨论蓝天的时候,乌云正在集结。

真的,这不是编程之道。

当经理作出承诺的时候,没有人理会游戏程序。当财务做长期计划的时候,和谐和秩序就会恢复。当资深科学家解决手头实际问题的时候,问题很快会被解决。

真的,这是编程之道。

6.2

为什么程序员没效率?因为他们的时间都浪费在开会上了。

为什么程序员叛逆?因为管理层介入太多。

为什么程序员一个接一个地辞职?因为他们已经无法承受了。

在槽糕的管理下工作,他们已经不再珍惜他们的工作。

6.3

某个经理就要被炒鱿鱼了,但他下面的一个程序员发明的一个新程序大受欢迎,卖得很好。结果经理保住了工作。

经理试图给那个程序员奖励,但程序员拒绝了,说,“我写那个程序是应该我觉得那个想法有意思,因此我不期待奖赏。”

听到这话经理评价道,“这个程序员尽管职位低微,却能真正理解一个员工的职责。我们要把他提升到高贵的管理顾问的职位!”

但是程序员听到这个后又一次拒绝了,说道,“我存在所以我编程。如果我升职了,那么我除了浪费大家的时间之外将无所事事。还有别的事吗?我还有个程序要写呢。”

6.4

经理来到他的程序员们面前告诉他们:“关于你们的工作时间:你们要早上九点到,下午五点走。”一说到这,所有人都愤怒起来,有几个当场就辞职了。

于是经理说:“好吧,那么你们可以自行调节工作时间,只要你们按进度完成项目。”程序员现在满意了,开始中午上班然后一直工作到凌晨。

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?"

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?"

7.2

In the east there is a shark which is larger than all other fish. It changes into a bird whose wings 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 programmers, 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.

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.

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.

"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."

7.4

The master programmer moves form program to program without fear. No change in management can harm him. He will not be fired, even if the project is cancelled. Why is this? He is filled with Tao.

卷七 公司智慧

编程大师如是说:“你可以演示一个程序给公司高管看,但你无法让他脱离计算机盲。”

7.1

新手问大师:“东边有个巨大的树形结构被人们称为‘公司总部’。它充斥着副总裁和会计师,臃肿得都没形了。它发出一堆堆的通知,上面说‘这样做!’或‘那样做!’,没有人知道什么意思。每年都有新名字出现在结构图上,但都没什么用。这种不自然的实体怎么能够存在呢?”

大师答道:“你察觉到这个巨大的结构,为它的不合理而感到不安。你能不能从它的无尽轮回中消遣一下呢?你难道不能享受这种偏安一方无人打扰你写程序的舒适吗?你管他有用没用干什么?

7.2

东边有条鲨鱼大过所有其它鱼。它变形成一支鸟,翅膀像云一样遮天盖日。当它穿越大陆的时候带来了总部的消息。它把这个消息丢到程序员中,就像海鸥在沙滩上留下粪便。然后大鸟御风而去,在蓝天中回家。

新手程序员惊奇地盯着大鸟,因为他不懂那是什么。一般程序员畏惧鸟的到来,因为他害怕它带来的消息。编程大师继续在终端前工作,因为它不知道大鸟来了又走。

7.3

象牙塔里的魔法师带来了他的最新发明给编程大师检查。大师安静地等待着魔法师把一个巨大的黑盒子用推车推进办公室。

“这是一个集成的分布式通用工作站”,魔法师开始介绍,“人性化设计,专有操作系统,第六代编程语言,多个最先进的用户界面。我的助手们花了数百个人年才造出来。是不是叹为观止?”

大师的眉毛略微抬了抬。“确实叹为观止”,他说。

“公司总部下达了命令”,魔法师继续说,“所有人都要用这个作为新程序的平台。你同意吗?”

“当然”,大师回答,“我现在就要人把它运到数据中心去!”魔法师得意地回到了象牙塔。

几天后,一个新手溜达到大师程序员的办公室,说,“我这不到我的新程序的打印清单。你知道它可能在哪里吗?”

“知道”,大师答,“打印清单都堆在数据中心的平台上。”

7.4

大师程序员一点都不害怕从一个程序转到另一个程序。任何管理层的变化都伤害不到他。就算项目被取消他也不会被炒鱿鱼。为什么这样?因为他身上充满了道。

Hardware and Software
Book Eight

Thus spake the master programmer:
"Without the wind, the grass does not move. Without software, hardware is useless."

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?"

The master replied, "Why do you ask such foolish questions? That company is large because it is large. If it only made hardware, nobody would buy it. If it only made software, nobody would use 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."

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?"

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 settings?"

The master dropped the device to the ground and crushed it under foot. And suddenly the novice was enlightened.

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- consistant and easy-to-use. Why do you not quit your present job and join me here?"

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 as multifaceted 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.

8.4

Hardware met Software on the road to Changtse. Software said: "You are Yin and I am Yang. If we travel together we will become famous and earn vast sums of money." And so the set forth together, thinking to conquer the world.

Presently they met Firmware, who was dressed in tattered rage 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 seek fortune, for it is complete within itself. It exists beyond space and time."

Software and Hardware , ashamed, returned to their homes.

卷八 硬件和软件

大师程序员如是说:“没有风,草不会动。没有软件,硬件没用。”

8.1

新手问大师:“我发现有一个计算机公司比其它公司都大很多。它跟竞争对手比起来就像巨人跟侏儒一样。它的一个部门都可以形成完整的业务。怎么会这样?”

大师答,“你怎么会问这么愚蠢的问题?那个公司大是因为它大。如果它只做硬件没人会买。如果它只做软件没人会用。如果他只维护系统,人们会把它当下人对待。但由于他组合和所有这些事情,人们认为它是神!通过不努力追求卓越,它熬不费力地征服了别人。”

8.2

一天,大师程序员碰到新手程序员。大师注意到新手全神贯注地玩一个手持电脑游戏。“打扰”,他说,“我能看看吗?”

新手立刻毕恭毕敬把设备递给大师。“我看这个设备说有三个游戏级别:容易、适中、难”,大师说。“不过每个这样的设备都有另外一个游戏级别,在那个级别人既不能征服机器,机器也不能征服人。”

“劳您大架,伟大的大师”,新手恳求道,“我怎么找到这个神秘的设置?”

大师把设备扔到地上用脚踩烂。突然新手开窍了。

8.3

曾经有个程序员在微处理器上工作。“看看我在这里多么幸运”,他对一个来访的主机程序员说,“我有自己的操作系统和文件存储设备。我不用跟任何人分享资源。软件是自一致的而且容易使用。你为什么不辞掉现在的工作到我们这儿来呢?”

于是主机程序员向他的朋友描述他的系统,“主机象一个古老的智者坐在数据中心中冥想。它的磁盘驱动器一个接一个地排列,象一片机械的海洋。软件功能复杂像多面的钻石,又像原始森林一样错综复杂。每个程序都是独特的,像快速流淌的河水一样穿过系统。这就是为什么我对现在的工作感到高兴。”

微机程序员听到这后沉默了。但是这两个程序员从此终生是朋友。

8.4

软件在去远方的路上碰到硬件。软件说:“你是阴我是阳。如果我们结伴,我们会出名并且挣很多很多的钱。”于是他们怀着征服世界的想法结伴而行。

不一会儿他们碰到了固件,固件衣衫褴褛,拄着跟带刺的拐杖蹒跚而行。固件对他们说:“道在阴阳之间,像湖水一样平静。它不追求名,因此没有人知道它。它不追求利,因为它本身就是财富。它存在于空间和时间之外。”

软件和硬件大感羞愧,各自返回家中。

E pilogue Book Nine

Thus spake the Master Programmer:
"Time for you to leave."

卷九 后记

编程大师如是说:“你该出师了。”

原创粉丝点击