经验丰富的程序员和其每日代码行数

经验丰富的程序员和其每日代码行数

John D. Cook是一位数学教授、程序员、顾问、经理人和统计学家,善于并享受结合运用这些技能来解决问题。他曾撰文说(中文):

“最近,我听说了一个关于缺乏经验的程序员和经验丰富的程序员每天写相同行数的代码的研究结果。其不同之处在于,经验丰富的编程人员让这些代码更高效,向着目标稳步前进;缺乏经验的程序员单纯地将大段的代码分隔开,并且多次复写相同的代码块直到它们看起来能够运行。或者不拆分代码,他们连续调试好多天,几乎是随机的改变一两行代码,直到这些代码看起来能够运行……

并且,也有研究显示,程序员每天编写相同行数的代码与他们使用的语言无关。你可能认为使用汇编语言的程序员每天能比使用像VB或Java之类的高级语言的程序员编写更多的代码,但是事实并非如此。虽然通过数代码的行数来衡量程序员的产量是一种很烂的方法,但它却是判断一个人大脑能装多少东西的好方法……”

John D. Cook


经验丰富的程序员和其每日代码行数


Experienced programmers and lines of code

by JOHN on JUNE 3, 2008

I heard of a study recently that concluded inexperienced and experienced programmers write about the same number of lines of code per day. The difference is that experienced programmers keep more of those lines of code, making steady progress toward a goal. Less experienced programmers write large chunks of code only to rip them out and rewrite the same chunk many times until the code appears to work. Or instead of ripping out the code, they debug for days on end, changing one or two lines at a time, almost at random, until the code appears to work.

As Greg Wilson pointed out in his interview, focusing on quality in software development often results in increased productivity as well. More effort goes into forward progress and less goes into re-work.

Not only do experienced programmers produce more lines of code worth keeping each day, they also accomplish more per line of code, sometimes dramatically more. But that’s not news. It’s well known that the best programmers aren’t just a little more productive than average, they’re one or two orders of magintude more productive. (See, for example, Joel Spolsky’s book Smart and Gets Things Done.) More interesting is that the best programmers don’t seem to have a much larger capacity for producing and understanding lines of code.

There have also been studies that show programmers produce about the same number of lines of code per day independent of the language they use. You might think that someone working in assembly language could produce more lines of per day than someone writing in a higher level language such as VB or Java, but that’s not the case. It seems that while counting lines of code is a terrible way to measure productivity, it is a good way to measure what you can expect someone to be able to hold in their head.

私信“01”领取海量C/C++的编程学习资料以及代码编辑工具。我设置好了自动回复,就看你们是不是需要这些了。

相关推荐