译:两个程序员的故事

The Parable of the two Programmers
Neil W. Rickert
Dept. of Math, Stat., and Computer Science,
University of Illinois at Chicago.

March 20, 1985

两个程序员的故事

Once upon a time, unbeknownst to each other, the “Automated Accounting Applications Association” and the “Consolidated Computerized Capital Corporation” decided that they needed the identical program to perform a certain service.

从前,有两个互不知名的公司 AAAA 和 CCCC,确信他们需要一个程序来负责相同的工作。

Automated hired a programmer-analyst, Alan, to solve their problem.

AAAA 公司聘请了一位名叫艾伦的程序分析员来解决问题。

Meanwhile, Consolidated decided to ask a newly hired entry-level programmer, Charles, to tackle the job, to see if he was as good as he pretended.

而同时,CCCC 公司决定让一个新近雇用的初级程序员查尔斯搞这件差事,看一看他是不是和自己吹嘘的一样高明。

Alan, having had experience in difficult programming projects, decided to use the PQR structured design methodology. With this in mind he asked his department manager to assign another three programmers as a programming team. Then the team went to work, churning out preliminary reports and problem analyses.

艾伦曾经参加过高深的项目,决定使用 PQR 结构化设计方法。带着这个想法,他请求部门经理再给他配备三名程序员来组成一个小组。于是该小组开始工作,历尽艰辛后提出了初步的报告以及需求分析。

Back at Consolidated, Charles spent some time thinking about the problem. His fellow employees noticed that Charles often sat with his feet on the desk, drinking coffee. He was occasionally seen at his computer terminal, but his office mate could tell from the rhythmic striking of keys that he was actually playing Space Invaders.

在 CCCC,查尔斯花了点时间来考虑这个问题。他的同事发现他经常把脚翘到桌子上,坐着喝咖啡。他偶尔也看一下电脑屏幕,不过从击键的节奏来看,谁都知道他其实在玩太空侵略者。

By now, the team at Automated was starting to write code. The programmers were spending about half their time writing and compiling code, and the rest of their time in conference, discussing the interfaces between the various modules.

AAAA 的小组已经开始编码了。程序员用一半的时间来写代码、编译,其他时间用来开会,讨论不同模块之间的接口。

His office mate noticed that Charles had finally given up on Space Invaders. Instead he now divided his time between drinking coffee with his feet on the table, and scribbling on little scraps of paper. His scribbling didn’t seem to be Tic Tac Toe, but it didn’t exactly make much sense, either.

查尔斯的同事发现他终于不玩游戏了。而是在跷脚享受咖啡时往纸上乱写乱画,尽管画的不是石头剪刀布,可也好不到哪儿去。

Two months have gone by. The team at Automated finally releases an implementation timetable. In another two months they will have a test version of the program. Then a two month period of testing and enhancing should yield a completed version.

两个月过去了。AAAA 小组发布了实现的时间表。过两个月就会有一个测试版了,再经过两个月的测试和增强应该会得到完整的版本。

The manager of Charles has by now tired of seeing him goof off. He decides to confront him. But as he walks into Charles’s office, he is surprised to see Charles busy entering code at his terminal. He decides to postpone the confrontation, so makes some small talk then leaves. However, he begins to keep a closer watch on Charles, so that when the opportunity presents itself he can confront him. Not looking forward to an unpleasant conversation, he is pleased to notice that Charles seems to be busy most of the time. He has even been see to delay his lunch, and to stay after work two or three days a week.

查尔斯的经理实在看够他的吊儿郎当了。可他到查尔斯的办公室一看,惊讶得发现这个家伙在忙着编程。他决定暂不摊牌,于是随便说了两句后就走了。不过,他开始更密切地观察查尔斯,机会一出现就当面教训这个家伙。没有等到不愉快的交谈,因为他高兴地看到查尔斯大部分的时间都在忙碌着,甚至经常耽搁午餐,一周里还有两三天会加班。

At the end of three months, Charles announces he has completed the project. He submits a 500 line program. The program appears to be clearly written, and when tested it does everything required in the specifications. In fact it even has a few additional convenience features which might significantly improve the usability of the program. The program is put into test, and, except for one quickly corrected oversight, performs well.

三个月就要过去了,查尔斯宣布项目完成了。他提交了一个 500 行的程序。程序看起来写的很清爽,在测试中一切都符合规范,实际上还有几个附加的便利功能,可以显著的增强程序的可用性。进入测试过程后,除了一个很快就改正了的疏漏,都很好。

The team at Automated has by now completed two of the four major modules required for their program. These modules are now undergoing testing while the other modules are completed.

AAAAA 的小组现在已经完成了程序所需四个主要模块中的两个了。在其他模块完成的过程中这两个模块会先测试。

After another three weeks, Alan announces that the preliminary version is ready one week ahead of schedule. He supplies a list of the deficiencies that he expects to correct. The program is placed under test. The users find a number of bugs and deficiencies, other than those listed. As Alan explains, this is no surprise. After all this is a preliminary version in which bugs were expected.

又过了三个礼拜,艾伦宣布预备版早于计划一周就绪。他还提供了一个要改正的缺陷列表。程序到了测试阶段。用户发现了一堆不在列表中的问题和缺陷。按照艾伦的说法,这没什么可奇怪的。毕竟这是一个预备版本,里面有问题很正常。

After about two more months, the team has completed its production version of the program. It consists of about 2,500 lines of code. When tested it seems to satisfy most of the original specifications. It has omitted one or two features, and is very fussy about the format of its input data. However the company decides to install the program. They can always train their data-entry staff to enter data in the strict format required. The program is handed over to some maintenance programmers to eventually incorporate the missing features.

又过了大约两个月,小组完成了这个程序的产品化版本。大约包含了 2500 行代码。测试时看起来能够满足原有规格的大部。漏掉了一两个功能,输入数据的格式极为糟糕。但公司决定使用。他们要经常训练数据录入人员以使他们能够按照所需的精确格式输入。程序被移交给维护程序员,来把丢掉的功能最终加上。

Sequel:

结局:

At first Charles’s supervisor was impressed. But as he read through the source code, he realized that the project was really much simpler than he had originally though. It now seemed apparent that this was not much of a challenge even for a beginning programmer.

起先查尔斯的主管留下了深刻的印象。不过当他通读源代码后,他意识到这个项目要比他原先考虑的简单的多。现在看来,显然连作为一个对初级程序员的考验都够不上。

Charles did produce about 5 lines of code per day. This is perhaps a little above average. However, considering the simplicity of the program, it was nothing exceptional. Also his supervisor remembered his two months of goofing off.

查尔斯每天大约写 5 行代码。或许比平均水平略高。但是,考虑到是这么简单的一个程序,也没什么不寻常。不过主管还是记住了他两个月的游手好闲。

At his next salary review Charles was given a raise which was about half the inflation over the period. He was not given a promotion. After about a year he became discouraged and left Consolidated.

其后的加薪评审时,查尔斯被加了相当于当时通货膨胀的一半薪水。他没有被升职。大约一年后他变得消沉起来,离开了 CCCC。

At Automated, Alan was complimented for completing his project on schedule. His supervisor looked over the program. With a few minutes of thumbing through he saw that the company standards about structured programming were being observed. He quickly gave up attempting to read the program however; it seemed quite incomprehensible. He realized by now that the project was really much more complex than he had originally assumed, and he congratulated Alan again on his achievement.

在 AAAA,艾伦由于按期完成了项目而被称赞。主管来看程序,用几分钟翻了翻后发现遵守了公司关于结构化编程的标准。他迅速放弃了要读程序的企图,那看起来是一件相当不能让人理喻的事情。现在他意识到这个项目要比他当初设想的复杂许多,于是他再次祝贺艾伦的成就。

The team had produced over 3 lines of code per programmer per day. This was about average, but, considering the complexity of the problem, could be considered to be exceptional. Alan was given a hefty pay raise, and promoted to Systems Analyst as a reward for his achievement.

项目组每个程序员每天写 3 行多代码。这是平均水平,不过,考虑到这个问题的复杂度,应该说是很不寻常的了。艾伦被给予重奖,并且作为对他的成绩的奖赏,被提拔为系统分析员。

发表评论

电子邮件地址不会被公开。 必填项已用*标注