我這里有它的英漢對(duì)比版——the tao of programming —— 編程之道(1)
發(fā)表時(shí)間:2024-06-19 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]translated by geoffrey james[小趙]翻譯整理說(shuō)明: 本文是<<編程之道>> <<編程之禪>><<計(jì)算機(jī)時(shí)代的寓言>>其中的一冊(cè), 由小趙翻譯整理, 另外, 這三冊(cè)書(shū)的完整電子文檔由小趙根據(jù)市面上的...
translated by geoffrey james
[小趙]翻譯整理
說(shuō)明:
本文是<<編程之道>> <<編程之禪>><<計(jì)算機(jī)時(shí)代的寓言>>其中的一冊(cè), 由小趙翻譯整理, 另外, 這三冊(cè)書(shū)的完整電子文檔由小趙根據(jù)市面上的<< 編程之道>>一書(shū)(包括了上面的三卷)錄入整理, 隨后將一起刊登(參見(jiàn)《編程之道》全譯文)。
table of contents 目錄
book 1 -- the silent void
book 2 -- 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:
編程大師如是說(shuō):
"when you have learned to snatch the error code from the trap frame, it will be time for you to leave."
“當(dāng)你從我手中奪走水晶球時(shí),就是你離開(kāi)的時(shí)候了!
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.
寂靜的虛空里誕生了神秘的東西,這種東西恒久存在永不消失,它是所有程序的根源所在,我不知道怎么形容它,姑且稱(chēng)它為編程之道。
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 greater, then the applications is great. the user is pleased and there is harmony in the world.
如果道是完美的,那么操作系統(tǒng)就是完美的,如果操作系統(tǒng)是完美的,那么編譯囂就是完美的,如果編譯囂是完美的,那么應(yīng)用程序就是完美的,所以用戶心滿意足,整個(gè)世界因此和諧。
the tao of programming flows far away and returns on the wind of morning.
編程之道去如黃鶴來(lái)如晨風(fēng)。
1.2
the tao gave birth to machine language. machine language gave birth to the assembler.
道生機(jī)器語(yǔ)言,機(jī)器語(yǔ)言生匯編囂。
the assembler gave birth to the compiler. now there are ten thousand languages.
匯編器生編譯器,最后產(chǎn)生上萬(wàn)種高級(jí)語(yǔ)言。
each language has its purpose, however humble. each language expresses the yin and yang of software. each language has its place within the tao.
不論多么的微不足道,每種語(yǔ)言都有它自己的目的,每種語(yǔ)言都表達(dá)了軟件的陰陽(yáng)兩極。每種語(yǔ)言都各得其道。
but do not program in cobol if you can avoid it.
但是盡量不要用cobol語(yǔ)言。
1.3
in the beginning was the tao. the tao gave birth to space and time. therefore, space and time are the yin and yang of programming.
道之初,帶來(lái)了空間和時(shí)間,所以,空間和時(shí)間是編程的陰陽(yáng)兩極。
programmers that do not comprehend the tao are always running out of time and space for their programs. programmers that comprehend the tao always have enough time and space to accomplish their goals.
不懂編程之道的程序員常常把空間和時(shí)間消耗殆盡,得道的程序員則總是有足夠的空間和時(shí)間去完成編程任務(wù)。
how could it be otherwise?
否則會(huì)是什么樣呢?
1.4
the wise programmer is told about the tao and follows it. the average programmer is told about the tao and searches for it. the foolish programmer is told about the tao and laughs at it.
上士聞道,從而行之。中士聞道,謹(jǐn)而尋之。下士聞道,大笑之。
if it were not for laughter, there would be no tao.
大笑不足為道。
the highest sounds are the hardest to hear. going forward is a way to retreat. greater talent shows itself late in life. even a perfect program still has bugs.
希音不聞,進(jìn)即是退,大囂晚成。任何程序都有漏洞。
--------------------------------------------------------------------------------
the ancient masters
book two
thus spake the master programmer:
編程大師如是說(shuō):
"after three days without programming, life becomes meaningless."
三日不編程,食肉無(wú)味。
2.1
the programmers of old were mysterious and profound. we cannot fathom their thoughts, so all we do is describe their appearance.
遠(yuǎn)古時(shí)代的編程大師們高深莫測(cè),我們不能揣測(cè)他們的所思所想,只能描述外表所見(jiàn)。
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.
他達(dá)明,如狐貍過(guò)水;機(jī)警,如戰(zhàn)場(chǎng)上的將軍;和善,如主婦款待客人;簡(jiǎn)單,呆若木雞;混沌,如深淵之水。
who can tell the secrets of their hearts and minds?
誰(shuí)能道盡他們的所有?
the answer exists only in the tao.
答案僅存于道。
2.2
grand master turing once dreamed that he was a machine. when he awoke he exclaimed:
超級(jí)大師圖靈曾夢(mèng)見(jiàn)自己是一臺(tái)機(jī)器,醒后他這樣回憶:
"i don't know whether i am turing dreaming that i am a machine, or a machine dreaming that i am turing!"
“我不知道是圖靈夢(mèng)見(jiàn)自己變成機(jī)器還是機(jī)器夢(mèng)見(jiàn)自己變成圖靈!
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. their hair was long and unkempt and their clothes were wrinkled and old. they crashed out hospitality suites and they made rude noises during my presentation."
一個(gè)大公司的程序員參加一個(gè)軟件會(huì)議后向他的主管匯報(bào):“那些別的公司的程序員都是些什么樣的人呀?他們舉止不雅,不修邊幅,頭發(fā)蓬亂,衣服破舊,根本不熱情好客,還在我說(shuō)話的時(shí)候亂嚷嚷!
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?"
他的主管說(shuō):“我不應(yīng)該讓你參加這次會(huì)議,這些程序員生活在現(xiàn)實(shí)世界之外。他們認(rèn)為生活是可笑的,一場(chǎng)意外的偶然而已。他們來(lái)去自由,無(wú)所牽掛,他們只為他們的程序生活。為什么要用世俗的煩擾去擾亂他們呢?”
"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 programmers in the world. why is this?"
一個(gè)初學(xué)者問(wèn)主管經(jīng)理:“有一個(gè)程序員,他從來(lái)不預(yù)先設(shè)計(jì),也不寫(xiě)文檔,甚至不測(cè)試他的程序,但是知道他的人都認(rèn)為他是世界上最偉大的程序員,為什么呢?”
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 the tao."
經(jīng)理說(shuō):“那個(gè)程序員掌握了道。他不需要預(yù)先進(jìn)行設(shè)計(jì);系統(tǒng)崩潰時(shí)他也從不煩燥,只是接受發(fā)生的一切而不管發(fā)生的事是好是壞 。他不需要寫(xiě)文檔,他從不顧及有沒(méi)有人看他寫(xiě)的代碼。他也不需要進(jìn)行測(cè)試;他寫(xiě)的每個(gè)程序都有一個(gè)完美的自我,平靜而優(yōu)雅,它們的目的不言自明。他已經(jīng)真正掌握了道的精髓!