Book Four Coding
Book Five Maintenance
第五篇 維護
Thus speak the master programmer:
"Though a program be three lines long, someday it 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 that 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 agree 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 a simple financial package.
The novice worked furiously for many days, but when his master reviewed the 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?
難道一位好農民會漏掉他所種的一株莊稼嗎?
難道一位好老師會忽視哪怕是最差的學生嗎?
難道一位好父親會允許他唯一的孩子挨餓嗎?
難道一位好程序員會不願意維護他的程序嗎?

Leave a comment