源代码-序言
Prologue
序言,开场白
When I was around thirteen, I started hanging out with a group of boys who met up for regular long hikes in the mountains around Seattle. We got to know each other as Boy Scouts. We did plenty of hiking and camping with our troop, but very quickly we formed a sort of splinter group that went on our own expeditions—and that’s how we thought of them, as expeditions. We wanted more freedom and more risk than the trips the Scouts offered.
大约十三岁的时候,我开始和一群男孩混在一起,我们定期在西雅图周边的山里进行长途徒步。我们是在童子军活动中认识的。我们和童子军团一起做了不少徒步和露营,但很快我们就形成了一个类似分支的小团体,去进行自己的探险——我们就是这样看待这些活动的,称之为探险。我们想要比童子军提供的旅行更多的自由和风险。
There were usually five of us—Mike, Rocky, Reilly, Danny, and me. Mike was the leader; he was a few years older than the rest of us and had vastly more outdoor experience. Over the course of three years or so, we hiked hundreds of miles together. We covered the Olympic National Forest west of Seattle and Glacier Peak Wilderness to the northeast and did hikes along the Pacific Coast. We’d often go for seven days or more at a stretch, guided only by topographic maps through old-growth forests and rocky beaches where we tried to time the tides as we hustled around points. During school breaks, we’d take off on extended trips, hiking and camping in all weather, which in the Pacific Northwest often meant a week of soaked, itchy Army surplus wool pants and pruney toes. We weren’t doing technical climbing. No ropes or slings or sheer rock faces. Just long, hard hikes. It wasn’t dangerous beyond the fact that we were teenagers deep in the mountains, many hours from help and well before cell phones were a thing.
我们通常有五个人——迈克、罗基、里利、丹尼和我。迈克是领头的,他比我们其他人年长几岁,户外经验也丰富得多。在大约三年的时间里,我们一起徒步数百英里。我们走遍了西雅图以西的奥林匹克国家森林、东北方向的冰川峰荒野,还沿着太平洋海岸线徒步。我们常常连续七天甚至更长时间出发,只依靠等高线地图,在古老的原始森林和岩石海滩上穿行,努力赶在潮汐合适的时候绕过各个岬角。在学校假期里,我们会进行长途旅行,在各种天气下徒步露营,而在太平洋西北地区,这通常意味着一周穿着湿透、发痒的军用毛裤,脚趾也泡得皱巴巴的。我们并没有进行技术性攀岩。没有绳索、 吊带或陡峭的岩壁。只是漫长而艰难的徒步。我们是十几岁的少年,身处深山之中,离救援点有好几个小时路程,在手机还没有问世之前,除此之外,并不危险。
Over time we grew into a confident, tight-knit team. We’d finish a full day of hiking, decide upon a place to camp, and with hardly a word we’d all fall into our jobs. Mike and Rocky might tie up the tarp that would be our roof for the night. Danny foraged the undergrowth for dry wood, and Reilly and I coaxed a starter stick and twigs into our fire for the night.
随着时间的推移,我们成长为一个自信、团结紧密的团队。我们完成一整天的徒步后,会选定一个扎营地点,几乎不用多说,大家就会自然而然地各司其职。迈克和罗基可能会把防雨布固定好,那将成为我们夜晚的屋顶。丹尼会在灌木丛中寻找干燥的木头,而瑞利和我则会一起引燃火柴和细枝,生起我们夜晚的篝火。
And then we ate. Cheap food that was light in our packs but substantial enough to fuel us through the trip. Nothing ever tasted better. For dinner we’d chop up a brick of Spam and mix it with Hamburger Helper or a packet of beef Stroganoff mix. In the morning, we might have Carnation Instant Breakfast mix or a powder that with water transformed into a western omelet, at least according to the package. My morning favorite: Oscar Mayer Smokie Links, a sausage billed as “all meat,” now extinct. We used a single frying pan to prepare most of the food, and we ate out of empty #10 coffee cans we each carried. Those cans were our water pails, our saucepans, our oatmeal bowls. I don’t know who among us invented the hot raspberry drink. Not that it was a great culinary innovation: just add instant Jell-O mix to boiling water and drink. It worked as dessert or as a morning sugar boost before a day of hiking.
然后我们开始吃饭。那些食物价格便宜,装在背包里不占地方,却足够给我们提供能量,支撑我们完成整个旅程。没有什么比这更美味的了。晚餐时,我们会把一整块午餐肉切碎,和汉堡助手(Hamburger Helper)或者一包牛肉斯特罗加诺夫酱料混合在一起。早上,我们可能会喝 Carnation 即溶早餐粉,或者用一种粉末冲水做成“西部煎蛋”,至少包装上是这么写的。我早上最爱的是 Oscar Mayer 的 Smokie Links 香肠,这是一种号称“纯肉制成”的香肠,现在已经绝版了。我们大多用一口平底锅做饭,吃的容器则是每个人背的空号10咖啡罐。那些罐子既是我们的水桶,也是我们的汤锅,还是我们的燕麦碗。我不知道我们当中是谁发明了热覆盆子饮料。那倒也不是什么伟大的烹饪创新:就是把即溶果冻粉加到沸水里,然后喝掉。它既可以当甜点,也可以在徒步旅行前当一顿早餐糖分补充。
We were away from our parents and the control of any adults, making our own decisions about where to go, what to eat, when we slept, judging for ourselves what risks to take. At school, none of us were the cool kids. Only Danny played an organized sport—basketball—and he soon quit that to make time for our hikes. I was the skinniest of the group and usually the coldest, and I always felt like I was weaker than the others. Still, I liked the physical challenge, and the feeling of autonomy. While hiking was becoming popular in our part of the country, not a lot of teenagers were traipsing off in the woods for eight days on their own.
我们远离父母和任何成人的管束,自己决定去哪儿、吃什么、何时睡觉,自行判断该承担哪些风险。在学校里,我们都不是那些“酷孩子”。只有丹尼参加过有组织的运动——篮球,但他很快就退出了,以便有时间陪我们去远足。我是小组里最瘦的,通常也是最冷的那个,总觉得自己比其他人弱。尽管如此,我还是喜欢这种身体上的挑战,以及那种自主的感觉。当时远足在我们所在的地区已经流行起来,但很少有青少年会独自在森林里徒步八天。
That said, it was the 1970s, and attitudes toward parenting were looser than they are today. Kids generally had more freedom. And by the time I was in my early teens, my parents had accepted that I was different from many of my peers and had come to terms with the fact that I needed a certain amount of independence in making my way through the world. That acceptance had been hard-won—especially for my mother—but it would play a defining part in who I was to become.
话虽如此,那毕竟是20世纪70年代,人们对育儿的态度比现在要宽松得多。孩子们通常拥有更多的自由。到了我十几岁的时候,我的父母已经接受了我的与众不同,也接受了这样一个事实:我在闯荡世界的过程中需要一定的独立性。这种接纳来之不易——尤其是对我母亲而言——但它将在我未来的成长中扮演决定性的角色。
Looking back on it now, I’m sure all of us were searching for something on those trips beyond camaraderie and a sense of accomplishment. We were at that age when kids test their limits, experiment with different identities—and also sometimes feel a yearning for bigger, even transcendent experiences. I had started to feel a clear longing to figure out what my path would be. I wasn’t sure what direction it would take, but it had to be something interesting and consequential.
回想起来,我确信我们所有人当时在那些旅行中寻找的,不仅仅是友谊和成就感。我们正处于那个年纪——孩子们会挑战极限,尝试不同的身份,有时还会对更宏大、甚至超越世俗的经历产生渴望。我开始清晰地渴望弄清楚自己的人生道路会是什么样子。我不确定它会通向何方,但它必须是有趣且有意义的事情。
Also in those years, I was spending a lot of time with a different group of boys. Kent, Paul, Ric, and I all went to the same school, Lakeside, which had set up a way for students to connect with a big mainframe computer over a phone line. It was incredibly rare back then for teenagers to have access to a computer in any form. The four of us really took to it, devoting all our free time to writing increasingly more sophisticated programs and exploring what we could do with that electronic machine.
在那些年里,我和另一群男孩相处的时间也很多。肯特、保罗、里克和我都在湖畔中学就读,那所学校已经建立了一种方式,让学生可以通过电话线连接到一台大型主机计算机。在当时,十几岁的青少年能以任何形式接触到计算机是非常罕见的。我们四个人对此非常着迷,把所有的空闲时间都投入到编写越来越复杂的程序中,探索那台电子机器能做些什么。
On the surface, the difference between hiking and programming couldn’t have been greater. But they each felt like an adventure. With both sets of friends I was exploring new worlds, traveling to places even most adults couldn’t reach. Like hiking, programming fit me because it allowed me to define my own measure of success and it seemed limitless, not determined by how fast I could run or how far I could throw. The logic, focus, and stamina needed to write long, complicated programs came naturally to me. Unlike in hiking, among that group of friends, I was the leader.
—
Toward the end of my sophomore year, in June 1971, Mike called me with our next trip: fifty miles in the Olympic Mountains. The route he chose was called the Press Expedition Trail, after a group sponsored by a newspaper that had explored the area in 1890. Did he mean the same trip on which the men nearly starved to death and their clothes rotted on their bodies? Yes, but that was a long time ago, he said.
Eight decades later it would still be a tough hike; that year had brought a lot of snow, so it was a particularly daunting proposition. But since everyone else—Rocky, Reilly, and Danny—was up for it, there was no way I was going to wimp out. Plus, a younger scout, a guy named Chip, was game. I had to go.
The plan was to climb the Low Divide pass, descend to the Quinault River, and then hike the same trail back, staying each night in log shelters along the way. Six or seven days total. The first day was easy and we spent the night in a beautiful snow-covered meadow. Over the next day or two, as we climbed the Low Divide, the snow got deeper. When we reached the spot where we planned to spend the night, the shelter was buried in snow. I enjoyed a moment of private elation. Surely, I thought, we’d backtrack, head down to a far more welcoming shelter we had passed earlier in the day. We’d make a fire, get warm, and eat.
Mike said we’d take a vote: head back or push on to our final destination. Either choice meant a several-hour hike. “We passed a shelter at the bottom; it’s eighteen hundred feet down. We could go back down and stay there, or we could continue on to the Quinault River,” Mike said. He didn’t need to spell out that going back meant aborting our mission to reach the river.
“What do you think, Dan?” Mike asked. Danny was the unofficial second in command in our little group. He was taller than everyone else, and a very capable hiker with long legs that never seemed to tire. Whatever he said would sway the vote.
“Well, we’re almost there, maybe we should just go on,” Danny said. As the hands went up, it was clear I was in the minority. We’d push on.
A few minutes down the trail I said, “Danny, I’m not happy with you. You could have stopped this.” I was joking—sort of.
I remember this trip for how cold and miserable I felt that day. I also remember it for what I did next. I retreated into my own thoughts.
I pictured computer code.
Around that time, someone had loaned Lakeside a computer called a PDP-8, made by Digital Equipment Corp. This was 1971, and while I was deep into the nascent world of computers, I had never seen anything like it. Up until then, my friends and I had used only huge mainframe computers that were simultaneously shared with other people. We usually connected to them over a phone line or else they were locked in a separate room. But the PDP-8 was designed to be used directly by one person and was small enough to sit on the desk next to you. It was probably the closest thing in its day to the personal computers that would be common a decade or so later—though one that weighed eighty pounds and cost $8,500. For a challenge, I decided I would try to write a version of the BASIC programming language for the new computer.
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.
By early the next morning we were climbing back up the Low Divide in heavy wind and sleet that whipped sideways in our faces. We stopped under a tree long enough to share a sleeve of Ritz crackers and continued. Every camp we found was full of other hikers waiting out the storm. So we just kept going, adding more hours to an interminable day. Crossing a stream, Chip fell and gashed his knee. Mike cleaned the wound and applied butterfly bandages; now we moved only as fast as Chip limped. All the while, I silently honed my code. I hardly spoke a word during the twenty miles we hiked that day. Eventually we came to a shelter that had room for us and set up camp.
Like the famous line “I would have written a shorter letter, but I did not have the time,” it’s easier to write a program in sloppy code that goes on for pages than to write the same program on a single page. The sloppy version may also run more slowly and use more memory. Over the course of that hike, I had the time to write short. On that long day I slimmed it down more, like whittling little pieces off a stick to sharpen the point. What I made seemed efficient and pleasingly simple. It was by far the best code I had ever written.
As we made our way back to the trailhead the next afternoon, the rain finally gave way to clear skies and the warmth of sunlight. I felt the elation that always hit me after a hike, when all the hard work was behind me.
—
By the time school started again in the fall, whoever had lent us the PDP-8 had reclaimed it. I never finished my BASIC project. But the code I wrote on that hike, my formula evaluator, and its beauty stayed with me.
Three and a half years later, I was a sophomore in college not sure of my path in life when Paul, one of my Lakeside friends, burst into my dorm room with news of a groundbreaking computer. I knew we could write a BASIC language for it; we had a head start. The first thing I did was to think back to that miserable day on the Low Divide and retrieve from my memory the evaluator code I had written. I typed it into a computer, and with that planted the seed of what would become one of the world’s largest companies and the beginning of a new industry.