编程之道--Book Five - Mainteance

摘自《编程之道》

将此书献给那些爱笑也爱思考的程序设计者,以及那些同程序设计者打交道的管理人员,当然他们也爱笑爱思考。 


编程之道--Book Five - Mainteance

Thus spake the master programmer:

编程大师如是说:

"Though a program be but three lines long, someday it will have to bemaintained."
“既使一个程序只有三行长,也总有一天需要去维护它” 

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 theprogram on which he was working. "I will be finished tomorrow," theprogrammer promptly replied.

经理问程序员要多长时间才能完成他的项目。“明天”

"I think you are being unrealistic," said the manager. "Truthfully, howlong will it take?"

“太不着边际了,老实说,要多久?”

The programmer thought for a moment. "I have some features that I wishto add. This will take at least two weeks," he finally said.

程序员想了一想说。“还有一些新的功能要加进去,可能至少要两个星期吧。”

"Even that is too much to expect," insisted the manager, "I will besatisfied if you simply tell me when the program is complete."

“即使两个星期恐怕也太夸张了,什么时候你只要告诉我说程序已经完成就好了。”


The programmer agreed to this.

page16image1456

Several years slated, the manager retired. On the way to his retirementlunch, he discovered the programmer asleep at his terminal. He had beenprogramming 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 reviewedhis program, he discovered that it contained a screen editor, a set ofgeneralized 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 beso 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?

一个好的农民不会不管他的庄稼。

一个好的老师不会不管哪怕是最差的学生。

一个好的父亲不会让他的任何一个孩子挨饿。

一个好的程序员不应拒绝维护他的程序。


你可能感兴趣的:(编程之道--Book Five - Mainteance)