Redis之父:我可不止是一只碼農(nóng)

一年前我暫停了寫代碼后開(kāi)始嘗試寫科幻小說(shuō)時(shí),以為這是兩條完全不一樣的路子。隨著寫的文字越來(lái)越多,不斷的推倒重寫那也是家常便飯了。我現(xiàn)在總算非常確定了,擼一個(gè)大系統(tǒng)和寫一本小說(shuō)本質(zhì)上其實(shí)差不太多,它們之間那是非常相似的。【這里我們?cè)试S Antirez 凡爾賽一把】
One year ago I paused my programming life and started writing a novel, with the illusion that my new activity was deeply different than the previous one. A river of words later, written but more often rewritten, I’m pretty sure of the contrary: programming big systems and writing novels have many common traits and similar processes.
最顯而易見(jiàn)的共同之處,那就是這兩種活都是在搬磚,一個(gè)是搬代碼,一個(gè)是搬單詞。代碼當(dāng)然不是用自然語(yǔ)言編寫的,但是它同樣也有自己的語(yǔ)法規(guī)則,這種規(guī)則一般只有程序員自己能懂,對(duì)外行人來(lái)說(shuō)那就兩眼一抹黑啦。
The most obvious parallel between the two activities is that in both of them you write something. Code is not prose written in a natural language, yet it has a set of fixed rules (a grammar), certain forms that most programmers will understand as natural and others that, while formally correct, will sound hard to grasp.
如果再深入一點(diǎn),你會(huì)發(fā)現(xiàn)寫小說(shuō)跟寫代碼一樣,都是在擺弄各種全局和局部變量,讓它們?cè)谝黄饏f(xié)作好。好的代碼是由一系列精妙易讀的語(yǔ)句組成【微觀】,整體上不同的組件之間是盡可能正交解耦的,交互的邊界非常清晰【宏觀】。好的小說(shuō)在微觀和宏觀這兩個(gè)尺度上也是一樣的,每個(gè)句子都要寫的很漂亮,全局的層次結(jié)構(gòu)和文章脈絡(luò)同樣也很關(guān)鍵。
There is, however, a much deeper connection between the two activities: a good program and a good novel are both the sum of local and global elements that work well. Good code must be composed of well written and readable single statements, but overall the different parts of the program must be orthogonal, designed in a coherent way, and have clean interactions. A good novel must also succeed in the same two scales of the micro and the macro. Sentences must be well written, but the overall structure and relationship between the parts is also crucial.
代碼和小說(shuō)之間還有一個(gè)不那么明顯的相通之處,那就是你需要持續(xù)不斷往前走以追究極致,它們并不是很輕松自然而然就寫出來(lái)的。關(guān)于這一點(diǎn),二十多年的代碼生涯幫我很大,我知道我必須夜以繼日的寫,今天也許是寫了 100 字,明天也許會(huì)寫 2000 字,但是通常你不會(huì)一天下來(lái)一個(gè)字都不寫的。當(dāng)你想抱著一種創(chuàng)造性的心態(tài)來(lái)完成你的大作時(shí),就會(huì)經(jīng)常深切地感受到什么叫文思枯竭。但是也不完全相同,作為工程師如果一天不寫代碼會(huì)被認(rèn)為是懶惰是懈怠。但是對(duì)于藝術(shù)家,這就不一樣了,慵懶的心態(tài)是創(chuàng)作時(shí)必須的靈感之源。
A less structural link between programming and writing is in the drive you need when approaching one or the other: to succeed you need to make progresses, and to make progresses you have to be consistent. There is extensive agreement on the fact that programs and novels don’t write themselves, yet. Twenty years of writing code helped me immensely with this aspect; I knew that things happen only if you sit every day and write: one day one hundred words, the other day two thousands, but rare is the day I don’t put words on the page. And if you have written code that is not just a “filler” for a bigger system, but a creation of your own, you know that writer block also happens in programming. The only difference is that for most people you are an engineer, hence, if you don’t work, you are lazy. The same laziness, in the case of an artist, will assume the shape of a fascinating part of the creative process.
接下來(lái)我們重點(diǎn)談?wù)劜灰粯拥牡胤健?/p>
The differences.
寫小說(shuō)和寫代碼最大的不同之處在于文字經(jīng)過(guò)編輯校對(duì)定稿后就基本不會(huì)再修改了,也會(huì)有些時(shí)候作者在多年之后會(huì)對(duì)原作進(jìn)行局部小修正然后再發(fā)布一個(gè)新版,但是這不多見(jiàn),而且這通常也只是一錘子買賣。代碼就不是這樣的,它需要不斷修改,需求源源不斷到來(lái),而且還經(jīng)常是多人一起改。也正因此產(chǎn)生了兩種不同的行為模式:程序員會(huì)覺(jué)得系統(tǒng)的初版無(wú)關(guān)緊要,反正時(shí)間總是要改進(jìn)它。但是作家就不行,對(duì)于每一本小說(shuō)他只有一次機(jī)會(huì)寫出來(lái),所以需要不斷反復(fù)的推倒重寫。說(shuō)起來(lái)你可能不信,其中的每個(gè)句子、每個(gè)章節(jié)、對(duì)話都要重寫兩三次,有時(shí)候甚至要重寫數(shù)十次。
I believe the most sharp difference between writing and programming is that, once written, edited and finalized, a novel remains immutable, mostly. There are several cases of writers returning on their novels after several years, publishing a bug fixed version of it, but this is rare and, even when happens, a one-shot process. Code evolves over time, is targeted by an endless stream of changes, often performed by multiple people. This simple fact has profound effects on the two processes: programmers often believe that the first version of a system can be quite imperfect; after all there will be time to make improvements. On the other hand writers know they have a single bullet for every novel, to the point that writing prose is mostly the act of rewriting. Rewriting sentences, whole chapters, dialogues that sound fake, sometimes two, three, or even ten times.
寫代碼還是需要向?qū)懶≌f(shuō)學(xué)習(xí)一下的,學(xué)習(xí)作家對(duì)待小說(shuō)原版的那種認(rèn)真勁:在初創(chuàng)的過(guò)程中隨心所欲、大刀闊斧、反復(fù)不斷的修改內(nèi)核,力求做到最優(yōu)雅的設(shè)計(jì)。我認(rèn)為系統(tǒng)最初的設(shè)計(jì)會(huì)非常影響后續(xù)的發(fā)展【好比性格決定命運(yùn)】,平滑自然的演進(jìn)才會(huì)慢慢誕生出一個(gè)漂亮完美的系統(tǒng),即使是在多年之后,系統(tǒng)整體上已經(jīng)面目全非,最初的版本只是其中的極小一部分。
I believe programming, in this regard, can learn something from writing: when writing the first core of a new system, when the original creator is still alone, isolated, able to do anything, she should pretend that this first core is her only bullet. During the genesis of the system she should rewrite this primitive kernel again and again, in order to find the best possible design. My hypothesis is that this initial design will greatly inform what will happen later: growing organically something that has a good initial structure will result in a better system, even after years of distance from the original creation, and even if the original core was just a tiny faction of the future mass the system would eventually assume.
最后再提一下我最近寫的科幻小說(shuō),我估計(jì)大家會(huì)很感興趣。自己檢查了很多遍之后,總算把它發(fā)給了我的編輯,他叫 Giulio Mozzi,未來(lái)幾周他會(huì)給我提一些修改意見(jiàn)。我會(huì)參考他的說(shuō)明來(lái)重新進(jìn)行一輪檢查,期望未來(lái)一兩個(gè)月能完成定稿。然后我就會(huì)發(fā)布這第一個(gè)意大利語(yǔ)版本,同時(shí)還會(huì)讓我遠(yuǎn)在美國(guó)的翻譯來(lái)搞定發(fā)表英文的版本。作家之路漫漫其修遠(yuǎn)兮,吾將上下而求索。
In case you are interested, a quick update about my sci-fi novel. After many self-reviews I sent the manuscript to my editor, Giulio Mozzi. He will send me the change proposals in a few weeks. I’ll start a new review process informed by his notes, and hopefully finalize the novel in one or two months. Then, finally, I’ll be ready to publish the Italian version. At the same time the finalized novel will be sent to my translator, in the US, and when she ends the translation the English version will be published as well. It’s a long journey, but one that I deeply enjoyed taking.
掃一掃關(guān)注【碼洞】
