《编程之禅》之程序员的诗
时间:2010-09-28 来源:cnblogs
今天在图书馆突然看到这本书(《The Zen of Programming》),顿时被吸引了。它没有具体的程序设计教法,而是抽象得像咱《伦语》一样,却意味深长。真的是很值得一读的一本书。现将在网上找的一个章节(第五节/水)整理如下。
The Zen Nun Yoshiko primarilywrote haiku -- short poems that attempt to
express a feeling or idea in a predefined set of syllables. Haiku expresses
much about the lonely life a programmer leads: the late nights spent debugging, the thankless toil of testing, the simple joy of watching a program compile.
All programmers share such experiences, though they seldom speak of them, even
among themselves.
The final selection of this book is evidently a fragment of a larger work.
The editor begs the indulgence of the reader for his inability to translate
the profound concepts of these poems in their full and original resonance.
尼姑阿幸最初是写俳句的。俳句即短诗,用一套预先下定义好的章节来试图表达一种情感或一种想法。阿幸的俳句则更多地表达了一名程序设计者的那种孤独的生活:为了调试而工作到深夜,徒劳无获的测试,看着一段程序编译时的那种简单的喜悦,等待。所有的程序设计者都有过这些体验,但他们很少提及,即使是在他们之间。
本书这最后一部分,显然是一部大作中的片段。作者不才。未能将这些短诗中的深奥的意蕴完全翻译出来,以达到和原诗类似的效果,还望读者多多包涵。
OnePrograms are but dreams
Born in formless, shapeless Zen.
We are but dreamers.
一
程序不过是梦,
生于无形无象的禅中,
我们只是那做梦的人。
I programmed three days
And heard no human voices.
But the hard disk sang.
二
我编程三日,
两耳不闻人声,
只有硬盘在歌唱。
Three
The compiler runs
Like a swift-flowing river.
I wait in silence.
三
编译程序在运行,
像一条湍急的河流,
我静静地等侯。
Four
Why do you use LISP?
I understand COBOL not.
Therefore I use LISP.
四
为何要用LISP?
COBOL语言我不懂,
所以我用LISP。
Five
I programmed all night.
Through the window, on my screen,
The rising sun shined.
五
编程一整夜,
透过窗户,照到屏幕上,
初升的太阳。
Six
Hardware and software,
We are your slaves and masters,
Our lives are programs.
六
硬件和软件,
我们是你们的主人和奴隶,
我们的生活是程序。
Seven
Can you hear the sound
Of a program on the desk?
The answer is NUL.
七
你能听见吗,
电脑桌上程序的声音?
答案是NUL。
Eight
I read my E-Mail.
The project has been cancelled.
Purging files, I weep.
八
电子邮件说,
项目已取消,
清理文档时,我哭了。
Nine
The computer center is empty,
Silent except for the whine of the cooling fans.
I walk the rows of CPUs,
My skin prickling with magnetic flux.
I open a door, cold and hard,
And watch the lights dancing on the panels.
A machine without soul, men call it,
But its soul is the sweat of my comrades,
Within it lie the years of our lives,
Disappointment, friendship, sadness, joy,
The algorithmic exaltations,
The long nights filled with thankless toil,
I hear the echoes of sighs and laughter,
And in the darkened offices
The terminals shine like stars.
九
计算中心空空荡荡,
静静的只有风扇在嗡鸣。
我走过一排排的CPU,
磁通量刺痛了我的皮肤。
我打开一扇门,又冷又硬,
看见指示灯在控制板上跳动。
一台没有灵魂的机器,人们说,
但它的灵魂是同事们的汗水,
在它里面有我们多年的生命,
失望,友谊,悲伤,欢乐,
算法成功时的狂喜,
和无数个徒劳无获的长夜。
我听见了叹息和欢笑的回声,
在这间黑洞洞的办公室里,
终端机闪耀着光芒,就像星星一样。
由Linux人社区编辑