读书人

[通译Joel On Software]Joel测试:12步

发布时间: 2013-11-03 15:39:14 作者: rapoo

[翻译Joel On Software]Joel测试:12步写出更高质量代码/The Joel Test: 12 Steps to Better Code

Joel on Software

The Joel Test: 12 Steps to Better Code

Joel测试:12步写出更高质量代码

byJoel SpolskyWednesday, August 09, 2000

Have you ever heard of SEMA[w1] ? It's a fairly esoteric system formeasuring how good a software team is. No, wait! Don't follow thatlink! It will take you about six years just to understand thatstuff. So I've come up with my own, highly irresponsible, sloppy test to ratethe quality of a software team. The great part about it is that it takes about3 minutes. With all the time you save, you can go to medical school.

你听说过SEMA么?是一种非常深奥的测试软件开发团队水平的系统标准。 等等,先别点开那个链接!那可要花费你约6年的时间去理解。所以我发明了我的“高度不负责”“草率”测试来衡量软件开发团队的质量。 不过这种测试方法的好处是它只需花3分钟。省下来的那些时间,够你再去读个医学院了。

The Joel Test Joel测试

    Do you use source control?
    你们使用代码管理么? Can you make a build in one step?
    你们能用一步生成项目版本构建么? Do you make daily builds?
    你们每天都做项目版本构建么? Do you have a bug database?
    你们有软件错误数据库么? Do you fix bugs before writing new code?
    你们在写新代码之前会修正之前的代码错误么? Do you have an up-to-date schedule?
    你们有最新的日程安排么? Do you have a spec?
    你们有规范么? Do programmers have quiet working conditions?
    你们的程序员有安静的工作环境么? Do you use the best tools money can buy?
    你们会使用能花钱买到的最好工具么? Do you have testers?
    你们有测试人员么? Do new candidates write code during their interview?
    你们在面试的时候会让候选人写代码么? Do you do hallway usability testing?
    你们有过道可用性测试么?

The neat thing about The Joel Test is that it's easy to get aquick yesor no to each question. You don't have to figure outlines-of-code-per-day or average-bugs-per-inflection-point. Give your team 1point for each "yes" answer. The bummer about The Joel Test isthat you really shouldn't use it to make sure that your nuclear powerplant software is safe.

Joel测试的优点是每个问题很容易都能得到一个“是”或“否”的回答。你不需要去计算 每天代码行数 或者 每转折点软件错误数。每一个“是”的回答就给你的团队加一分。 Joel测试不足的是:你可不要拿它去测试你的核电反应堆控制软件是安全的。

A score of 12 is perfect, 11 is tolerable, but 10 or lower and you'vegot serious problems. The truth is that most software organizations are runningwith a score of 2 or 3, and they need serious help, because companieslike Microsoft run at 12 full-time.

12分满分,11分可以接受,不过低于或等于10分意味着你们团队有严重的问题。 不过事实情况是大部分的软件组织以两到三分运营着。他们急需帮助, 因为像微软这样的公司始终是以12分运营的。

Of course, these are not the only factors that determine success orfailure: in particular, if you have a great software team working on a productthat nobody wants, well, people aren't going to want it. And it's possible toimagine a team of "gunslingers" that doesn't do any of this stuffthat still manages to produce incredible software that changes the world. But,all else being equal, if you get these 12 things right, you'll have adisciplined team that can consistently deliver.

当然,这些不是衡量软件开发成功或失败的唯一因素:特别是,如果你有个很优秀的团队在开发一个没人想要的产品,恩,人们不会想要的那东西的。而且很难想象一个团队的“高手”不做任何这些条目却仍然能够设法交付能够改变世界的优秀软件。不过,不考虑其他因素,如果你把这12样事情做好了,那么你就拥有一个能够持续交付的纪律严明开发小组。

1.Do you use source control? 你们使用代码管理么?
I'veused commercial source control packages, and I've used CVS, which is free, and let me tell you, CVS is fine. But if you don't have source control, you're going to stressout trying to get programmers to work together. Programmers have no way to knowwhat other people did. Mistakes can't be rolled back easily. The other neatthing about source control systems is that the source code itself is checkedout on every programmer's hard drive -- I've never heard of a project usingsource control that lost a lot of code.

我使用了商业代码管理包,我使用的是CVS,免费的,而且告诉你,CVS挺好的。 但如果你不用代码管理,你要让程序员协同工作就压力山大了。 程序员无法知道其他人做了什么。 发生错误无法很容的回滚。 代码管理的另一优点是:源代码本身是被检出到每个程序员自己的硬盘的 我从没听说过使用代码管理的项目丢失过一大堆的源代码。

2.Can you make a build in one step? 你们能一步生成项目构建版本么?
Bythis I mean: how many steps does it take to make a shipping build from thelatest source snapshot? On good teams, there's a single script you can run thatdoes a full checkout from scratch, rebuilds every line of code, makes the EXEs,in all their various versions, languages, and #ifdef combinations, creates theinstallation package, and creates the final media -- CDROM layout, downloadwebsite, whatever.

我这么说的意思是:你们从最新大代码映像构建出一个能发布的编译版本要花多少步? 在好的团队里,会有一个你能运行的脚本,从头开始完整的检出代码,重新编译每一行代码,生成EXE文件,不管版本,语言,#ifdef预编译宏的组合是怎样。 它能生成安装包,乃至最终的媒体版本—CDROM格式,网站下载之类的。

If the process takes any more than one step, it is prone to errors. Andwhen you get closer to shipping, you want to have a very fast cycle of fixingthe "last" bug, making the final EXEs, etc. If it takes 20 steps tocompile the code, run the installation builder, etc., you're going to go crazyand you're going to make silly mistakes.

如果这个过程花费超过一步,那么就容易产生错误。你越是接近发布日期,你就越想以更迅速的的周期去修正“最后”的软件错误,生成最终的可执行文件,等等。 如果要花20步才能编译代码,运行安装构建器,等等。 你就会发疯而且会犯很傻的错误。

For this very reason, the last company I worked at switched from WISEto InstallShield: we required that the installation process be ableto run, from a script, automatically, overnight, using the NT scheduler, andWISE couldn't run from the scheduler overnight, so we threw it out. (The kindfolks at WISE assure me that their latest version does support nightly builds.)

因为这个原因,我工作的上家公司从WISE转到了InstallShield:因为我们要求整个安装过程要能使用NT任务调度在晚上自动的从脚本运行,而WISE不能在晚上以计划任务运行,我们就把它给抛弃了。(WISE公司的家伙们向我保证了他们最新的版本确实支持隔夜自动构建)

3.Do you make daily builds? 你们每天都做项目版本构建么?
Whenyou're using source control, sometimes one programmer accidentally checks insomething that breaks the build. For example, they've added a new source file,and everything compiles fine on their machine, but they forgot to add thesource file to the code repository. So they lock their machine and go home,oblivious and happy. But nobody else can work, so they have to go home too,unhappy.

当你在使用源代码管理的时候,有时候一个程序员意外的提交了会导致项目编译构建失败的代码。例如,他们新加了一个源文件,所有东西在他们自己的机器上是能够正确构建的,但是他们忘了把这个源文件提交到代码库了。他们没注意就锁定自己的机器高高兴兴回家去了。但其他人都不能工作了,所以他们也得回家了,不过是不高兴地。

Breaking the build is so bad (and so common) that it helps to makedaily builds, to insure that no breakage goes unnoticed. On large teams, onegood way to insure that breakages are fixed right away is to do the daily buildevery afternoon at, say, lunchtime. Everyone does as many checkins as possiblebefore lunch. When they come back, the build is done. If it worked, great!Everybody checks out the latest version of the source and goes on working. Ifthe build failed, you fix it, but everybody can keep on working with thepre-build, unbroken version of the source.

打破系统正确编译构建的影响是如此之坏(并且很常见),这使得必须创建每天的版本构建来保证没有一次这样的中断会被忽略掉。在大的团队里,一个有效的保证这种中断马上被修正的方法是在每天中午的时候进行日常的版本构建,每个人在饭前都尽可能多的提交自己的工作。当他们吃饭回来,版本构建已经完成,如果构建成功,那太好了!每个人都把代码更新到最新的版本并继续工作。如果版本构建失败了,你就得修正它,但每个人都一个用前一个成功的未被打破的构建继续工作。

On the Excel team we had a rule that whoever broke the build, as their"punishment", was responsible for babysitting the builds untilsomeone else broke it. This was a good incentive not to break the build, and agood way to rotate everyone through the build process so that everyone learnedhow it worked.

在Excel项目里,我们有这样的一个规定,不管谁打破版本构建,作为对他们的“惩罚”,他们必须“照看”版本构建直到其他人打破了版本构建。 这是个很好的初衷让大家不要去打破构建,而且是很好的方法轮换团队里的每个人都通过维护日常构建去学习了解版本构建是如何工作的。

Read more about daily builds in my article Daily Builds are Your Friend.

你可以通过阅读我的文章 日常版本构建是你的好朋友 来了解更多。

4.Do you have a bug database?你们有软件错误数据库么?
Idon't care what you say. If you are developing code, even on a team of one,without an organized database listing all known bugs in the code, you are goingto ship low quality code. Lots of programmers think they can hold the bug listin their heads. Nonsense. I can't remember more than two or three bugs at atime, and the next morning, or in the rush of shipping, they are forgotten. Youabsolutely have to keep track of bugs formally.

我不管你说什么。如果你在做代码开发,哪怕是只有一个人的团队,如果你没有一个组织的很好的数据库来罗列代码中的所有错误,你只能交付低质量的代码。 很多程序员觉得他们能够在大脑里罗列所有的软件问题。胡扯。我一次都没办法记得两个或三个错误,而且第二天造成,或者急着发布,这些问题就被忘掉了。 你必须正式的来追踪管理这些软件错误。

Bug databases can be complicated or simple. Aminimal useful bug database must include the following data for every bug:

软件错误数据库可以复杂也可以简单。 最精简的可用的软件错误数据库必须为软件错误包含以下数据:

读书人网 >软件开发

热点推荐