代码改变世界

程序员阿士顿的故事

2010-12-24 00:23  Rollen Holt  阅读(284)  评论(0编辑  收藏  举报

前几天有人在 Stack Exchange 上提了一个问题 How can a new programmer impress the software engineer (boss)?(作为新手程序员如何给软件工程师出身的老板留下好印象?),Joel Spolsky(Joel on Software 的主人,《软件随想录》的作者) 看到了这个问题,他没有正面回答,而是在下面讲了悲催的程序员阿士顿的故事。我很喜欢这个故事,于是就大概翻译过来分享一下。翻译得很仓促,错误难免,见谅。

正文:

我告诉过你有关阿士顿的事情吗?

阿士顿是一个典型的吃玉米长大的农场男孩,他的父母曾经是嬉皮士,从来没有真正地同心协力过,直到有一天他的妈妈继承了密歇根农村的15亩地。然后他全家搬到了那里,买了一对奶山羊,靠在农贸市场把有机山羊奶酪卖给雅皮士们谋生。

那个时候阿士顿才10岁,他需要每天早晨4点起床给那些该死的山羊挤奶,这活非常累。阿士顿很喜欢上学,因为上学就意味着不需要跪在羊粪里工作了。整个高中他都异常努力,希望可以拿到一所名牌大学的奖学金,然后他就可以离开农场了。在大学里,他发现大学生活比农场的生活轻松多了,所以搞不明白为什么每个人不能像他那样每科都拿到A。他选择了软件工程作为自己的专业,因为他深信一个工程师绝对不需要早晨4点就起床。

阿士顿就这样从学校毕业了,他对软件产业并没有很多了解,所以他去了招聘会,申请了3份工作,并且都拿到了 offer 。然后他挑了一个给钱最多的offer:年薪高达 32,000美元,这是一家位于密歇根西南部的大家具公司,为全世界的企业生产办公小隔间(cubicle farm)。入职之后,因为阿士顿再也不想回到农场了,所以他决定给他的老板查理谢尔曼留下一个好印象。

“这个可不简单”,坐在他隔壁的同事杰夫说:“她在这里也算是个传奇人物了。”

“你的意思是?” 他说。

“嗯,你还记得几年前吗?那个时候到处都是关于千年虫的话题。”

阿士顿可能是太年轻了。“千年虫?”

“是这样的,没有人预料到在60年代写的程序在2000年还会继续运行,所以当时给年份只留了2个数字的存储空间,也就是说 1999 被存储为 99 。所以当 2000 年到来的时候,计算机系统就会崩溃,因为它会试图将 100 存储成2个数字。”

“真的?我还以为那只是个传说,” 阿士顿说。

“世界上所有其它的公司都没有发生什么事故,” 杰夫说。“因为它们花了数十亿美元去检查每一行代码。但是在我们公司,当然了,因为他们是狗娘养的混蛋,所以他们不愿意做任何测试。”

“完全没有做吗?”

“几乎没有。零测试。所以你瞧,当人们在2000年1月2号开始工作的时候,发现所有东西都不能工作了。他们不能打印生产计划,甚至不能打开半个装配生产线。没有人知道如何进行工作,工厂差不多停滞了。”

“你在开玩笑。” 阿士顿说。

“绝对没有。工厂整个都停止运转了。这个时候查理出现了。她那个时候还是个新人,曾经在微软,可能是NASA,也可能是其它机构工作过……没有人清楚为什么像她那样的牛人会到我们这种地方工作。然而她坐了下来,然后开始写代码。然后写代码。继续写代码。

查理整整写了九天代码,这九天她没有睡觉,没有吃东西,有些人说她甚至没有去过洗手间。她检查了一个又一个系统并且逐个修复了它们。那真是一件壮观的事情,老天,那些需要被修复的可是 COBOL(一种非常古老的编程语言)系统。在整个工厂处于停滞状态的时候,查理派人去大学图书馆找来了古老的 COBOL 手册。装配线上的工人站着直哆嗦,因为连恒温器也有千年虫问题。而查理则一杯接一杯地喝咖啡,像一个疯婆子一样不断敲击键盘。”

“哇。她没有去过洗手间?”

“呃,那个部分可能有稍微那么一点点的夸张成分,但是她的确连续9天工作24小时。总之,在1月11号的时候,就在开工前一天的5分钟,她走出了她的隔间,来到了打印机面前,按下了一个按钮,然后,奇迹出现了!生产计划打印出来了,团队计划也打印出来了。一切都是完美的,经过了完美的格式化,使用了一个稍微较小的字体把 ‘2000’放到了原来写‘99’的地方,她甚至还写了一个新的优先级优化系统,可以帮助工人在不得罪那么多客户的情况下赶上过去9天的生产进度。所有的装配线都开始工作,好像从来没有出现过错误一样,供暖也恢复了,打印出来的发票的年份由‘19100’变成了‘2000′。而且,之后谁也没有找到过一个bug.”

“得了吧!” 阿士顿说。“谁也写不出没有bug的代码。”

“她做到了。我亲眼看到的。这是他们第一天无间断地生产了相当于以往两天生产的小隔间。”

阿士顿目瞪口呆。“这简直是史诗阿。我怎么才能做到那样?”

“你做不到,伙计,没人能做到” 杰夫边说边回到了自己的电脑前面,继续玩已经玩了4个多月的斯波克和蝙蝠侠之间的在线战争游戏。

阿士顿不是一个轻言放弃的人,他发誓某一天他也会做一些富有传奇色彩的事情。但现实情况是,再也没有出现另外一个千年虫问题。而且在密歇根的那个地方,没有人可以提供一丁点儿关于如何写好程序的信息。事实上几乎没有什么事情需要程序员去做。分配给阿士顿去做的都是一些无聊的小项目……有一次他花了三个星期来处理这样一个事情:由于两个不同的销售税区域使用了相同邮政编码,导致在某个县的销售税是错误的。有趣的是,这个县位于纽约一个人烟稀少的地方,那里没有人买过办公小隔间,公司在那里也从来没有一个客户,所以他写的代码永远都不会运行。

日子就这样过去了。

两年来阿士顿一直带着热情和兴奋投入工作,迫不及待地想有所作为,想做一些了不起的事情。与此同时,他的同事却在上网冲浪,给朋友发短信,连续几个小时地玩电脑纸牌。

坐在他旁边的那个同事杰夫,只有一个工作内容:每周更新一个“显示本周有多少人在工作中受伤”的 Excel 电子表格。从来没有人受过伤。每周杰夫都打开那个电子表格,然后移动到页面的底部,在那里输入日期和一个数字0,点击保存,然后就完成了工作。

阿士顿甚至帮杰夫写了一个宏来自动化他的工作。杰夫不想被逮到,所以他拒绝安装这个宏。从那之后他们的关系就变僵了,真是尴尬。

在阿士顿工作两周年的那天早晨,他和以往一样开车去工作,然后忽然意识到了一些事情。

他写过的任何一行代码都没有运行过。

过去两年内他做的任何一件事情都没有对世界产生过什么影响。

而且在密歇根州的这个地方气温他妈的有24度,天空是灰色的,弥漫着臭味。他开的本田车也是一坨垃圾,在这个小镇上他没有任何朋友,他自己也什么都不是。

当他开车到林肯大街的时候,他看到了左边他所在的那个家具公司。在公司园区前面飘扬着三面旗帜:美国国旗,伟大的密歇根州的州旗以及一面有公司标识的红白相间的旗帜。他开车进入了转弯车道等待左转,他的前面有一长排车,在高峰期的时候需要等四到五个红绿灯才可以左转,所以阿士顿有足够的时间来回想他写过的代码有没有哪怕一行是被别人使用过的。

没有。他怔怔地留下了眼泪。

然后他没有左转,直接往前开了出去,这差点酿成了一起交通事故。阿士顿忘记了自己已经打了转向灯,而打了转向灯就意味着你不能直接往前开。

他沿着林肯大道开了下去,然后上了高速公路,他只是不停地往前开,一直来到了机场。他把他的垃圾本田扔在了航站楼的前面,心里非常清楚它会被拖走。他甚至没有去关车门就径直走到了柜台前面买了下一趟飞往旧金山的航班的机票,20分钟内起飞。然后他上了飞机,永远地离开了密歇根。

英文原文

Did I ever tell you about Ashton?

Ashton was your classic corn-fed farm boy. His parents had been hippies who never really managed to get their acts together until his mother inherited 15 acres in a rural part of Michigan. The family moved out there, bought a couple of dairy goats, and struggled to make a living selling organic goat cheese to the yuppies at the Ann Arbor Farmer’s Market.

From the time he was ten years old, Ashton had to wake up every morning at 4:00 a.m. and milk those damn goats, and it was exhausting. Ashton loved going to school because it meant he wasn’t working knee-deep in goat poop. Throughout high school, he studied his ass off, hoping that a scholarship to a good university would be his ticket out of the farm. He found college to be so much easier than farm life that he didn’t understand why everyone else didn’t get straight A’s like him. He majored in Software Engineering because he couldn’t imagine engineers ever being required to wake up at 4:00 a.m.

Ashton graduated from school without knowing much about the software industry, really, so he went to the career fair, applied for three jobs, got accepted by all three, and picked the one that paid the most: something insane like $32,000 a year, working at a big furniture company in the southwestern part of the state that manufactured cubicle farms for corporations all over the world. He never wanted to see a farm again, so he was determined to make a good impression on his boss, Charlie Sherman.

“That’s not going to be easy,” his cubicle-mate, Jeff, said. “She’s something of a legend here.”

“What do you mean?” he asked.

“Well, you remember a few years ago, when there was all that uproar about Y2K?”

Ashton was probably too young. “Y2K?”

“You know, nobody expected that all the old computer programs written in the 1960s would still be running in 2000, so they only had room for two digits for the year. Instead of storing 1999, they would store 99. And then when the year flipped over on January 1st, 2000, the computer systems crashed, because they tried to fit “100” in two digits.

“Really? I thought that was a myth,” Ashton said.

“At every other company in the world, nothing happened,” Jeff said. “They spent billions of dollars checking every line of code. But here, of course, they’re cheap bastards, so they didn’t bother doing any testing.”

“Not at all?”

“Zilch. Zero testing. Nada. And lo and behold, when people staggered back into work on January 2nd, not a single thing worked. They couldn’t print production schedules. They couldn’t get half of the assembly lines to even turn on. And nobody knew what shifts they were supposed to be working. The factory literally came to a standstill.”

“You’re kidding,” Ashton said.

“I shit you not. The factory was totally silent. Now, Charlie, she was new then. She had been working at Microsoft, or NASA, or something… nobody could figure out why someone like her would be working in our little armpit of a company. But she sat down, and she started coding. And coding. And coding.

“Charlie coded for nine days straight. Nine days without sleeping, without eating, some people even claimed she never went to the bathroom. She went from system to system and literally fixed all of them. It was something to behold. My God, there were COBOL systems in there that needed to be fixed. The whole factory at a standstill, and Charlie is sending people to the university library in Ann Arbor to find old COBOL manuals. Assembly-line workers are standing around shivering, because even the thermostats had a Y2K bug. And Charlie is drinking cup after cup of coffee and typing like a madwoman.”

“Wow. And she never went to the bathroom?”

“Well, that part might be a little bit of an exaggeration. But she really did work 24 hours for nine days straight. Anyway, on January 11th, about five minutes before the day shift is supposed to start, she comes out of her cubicle, goes to the line printer, hits a button, and boom! out comes the production schedules, and the team schedules, and everything is perfect, perfectly formatted, using a slightly smaller font so that the “2000” fits where it used to say “99,” and she’s even written a new priority optimizing system that helps them catch up with 9 days of missed production without pissing off too many customers, and all the assembly lines start running like nothing was ever wrong, and the heat comes on, and the invoices come out printed with ‘2000’ as the year instead of ‘19100,’ and after that day, nobody found a single bug.”

“Oh come on!” Ashton says. “Nobody writes code without bugs.”

“She did. I saw it with my own eyes. The first day back they ran two days worth of cubicles without a hiccup.”

Ashton was dumbstruck. “That’s epic. How can I live up to that?”

“You can’t, buddy, nobody can,” Jeff said, turning back to his computer terminal, where he resumed an online flame war over who would win in a fight, Spock or Batman, which had been raging for over four months.

Not one to give up, Ashton swore he would, one day, do something legendary. But the truth is, there never was another Y2K. And nobody, in that part of Michigan, gave a rat’s ass about good programming. There was almost nothing for the programmers to do, in fact. Ashton got dumb little projects assigned to him… at one point he spent three weeks working on handling a case where the sales tax in one particular county was wrong because some zip code spanned two different sales tax zones. The funny thing was, it was in some unpopulated part of New York State where nobody ever bought office cubicles, and they had never had a customer there, so his code would never run.

Ever.

For two years Ashton came into work enthusiastic and excited, and dying to make a difference and do something terrific and awesome, while his coworkers surfed the Internet, sent instant messages to their friends, and played computer solitaire for hours.

Jeff, his cubicle-mate, only had one responsibility: updating the weekly Excel spreadsheet indicating how many people were hurt on the job that week. Nobody ever was. Once a week, Jeff opened the spreadsheet, went to the bottom of the page, entered the date and a zero, hit save, and that was that.

Ashton even wrote a macro for Jeff that automated that one task. Jeff didn’t want to get caught, so he refused to install it. They weren’t on speaking terms after that. It was awkward.

On the morning of his two year anniversary at the cubicle company, Ashton was driving to work when he realized something.

Not one line of code that he had written had ever run.

Not one thing he had done in two years of work made any impact on the world.

And it was fucking 24 degrees in that part of Michigan, and it was gray, and smelly, and his Honda was a piece of crap, and he didn’t have any friends in town, and nothing he did mattered.

As he drove down Lincoln Avenue, he saw the furniture company ahead on the left. Three flags fluttered in front of the corporate campus: an American flag, a flag of the great state of Michigan, and a white and red flag with the company logo. He got in the turning lane behind a long line of cars waiting to turn left. It always took four or five traffic light cycles, at rush hour, to make the turn, so Ashton had plenty of time to try to remember if any code he had ever written was ever used by anyone.

And it hadn’t. And he fought back a tear.

And instead of turning left, he went straight, almost causing an accident because he forgot that the left turn light didn’t mean you could go straight.

And he drove right down Lincoln Avenue, and got onto the Gerald Ford freeway, and he just kept driving until he got to the airport over in Grand Rapids, and he left his crappy old Honda out right in front of the terminal, knowing perfectly well it would be towed, and didn’t even close the car door, and he walked right up to the Frontier Airlines counter and he bought himself a ticket on the very next flight to San Francisco, which was leaving in 20 minutes, and he got on the plane, and he left Michigan forever.

================== 我是分割线 =============

有人在这篇文章下面回复说:“The story continues: He went to work for Google, where he worked on Wave. And again, noone was using his code.” (故事继续:他去了Google编写 Google Wave. 所以,还是没有人使用他的代码。:D )

================== 再分割 ===============

不得不说 Joel 写文章真是没的说,一个小故事讲得生动有趣且不乏细节。国外程序员写文章写得好的可真多阿,像 Joel, Paul Graham, DHH… DHH 这家伙长得也帅,还上过时尚杂志的封面,我觉得肯定没有人称他们为“IT男”。相比之下,国内大部分程序员写文章都惨不忍睹,说好听点叫“散文”,一篇文章都是散的,上下文根本没有组织,完全自说自话,让人根本没有订阅的欲望。没见过缺少好的文档又非常流行的技术。也就是蔡学镛,刘未鹏等一些屈指可数的大牛写得好,而且我很佩服的蔡学镛还是台湾的,真是……哎。