Translations:Prologue/22/zh-cn
Before the hike I was working on the part of the program that would tell the computer the order in which it should perform operations when someone inputs an expression such as 3(2 + 5) x 8 − 3, or wants to create a game that requires complex math. In programming that feature is called a formula evaluator. Trudging along with my eyes on the ground in front of me, I worked on my evaluator, puzzling through the steps needed to perform the operations. Small was key. Computers back then had very little memory, which meant programs had to be lean, written using as little code as possible so as not to hog memory. The PDP-8 had just 6 kilobytes of the memory a computer uses to store data that it’s working on. I’d picture the code and then try to trace how the computer would follow my commands. The rhythm of walking helped me think, much like a habit I had of rocking in place. For the rest of that day my mind was immersed in my coding puzzle. As we descended to the valley floor, the snow gave way to a gently sloping trail through an old forest of spruce and fir trees until we reached the river, set up camp, ate our Spam Stroganoff, and finally slept.
徒步之前,我正在编写程序中负责告诉计算机如何按顺序执行操作的部分——当有人输入像3(2 + 5) x 8 − 3这样的表达式,或者想创建需要复杂数学运算的游戏时。在编程中,这个功能被称为公式求值器。我一边沿着山路跋涉,目光盯着前方的地面,一边琢磨着我的求值器,努力理清执行这些操作所需的步骤。当时的关键在于代码要简洁。早期的计算机内存非常有限,这意味着程序必须尽可能精炼,用最少的代码编写,以免占用过多内存。PDP-8计算机只有6千字节的内存用于存储正在处理的数据。我会先在脑海中构思代码,然后尝试追踪计算机如何执行我的指令。走路的节奏帮助我思考,就像我习惯原地摇晃身体一样。那天剩下的时间里,我的思绪都沉浸在编程难题中。当我们下到谷底,积雪逐渐变成一条穿过冷杉和云杉古老森林的缓坡小径,直到抵达河边,搭起帐篷,吃掉 Spam 炖菜,最后才入睡。