How many lines of code one needs to write to be able to write a paper?

This question interests me for a while.

At one extreme, I found papers, and some thesis that were outcome of change of a single parameter in a CFD code, like in the case of "Atmospheric boundary layer" turbulence model, that was produced by a single change in $c_\mu$ constant of the $k-\epsilon$ model.

On the other end there are papers, made after whole library of hundred thousand or more lines of code have been written, as in the case of big libraries like deal-II.

I find this important for understanding what is actual effort invested in writting a single sci comp paper, and to understand what this effort is consisted of.

As one approach for finding some answers I am considering to send questionaries to authors of a number of papers, and maybe plot a correlation between approximate number of code lines written and citation of the paper. This result can be published in figshare for curious ones.

I would like to hear some troughts.

• This might actually be a better fit for academia.stackexchange.com than here. I think that the number of lines of code is a false metric, the same as measuring the number of words in the paper. You can certainly do a fit between the average number of lines of code and several published papers in various disciplines, but I doubt it will give you any insight into the literature, just the same as if you had counted pictures or words. Oct 24 '13 at 23:47
• Computational science is specific because even before starting to write a paper you need to write some code, and since most people want to minimize the effort. I think this is the right place to ask this question because only computational scientists can give an answer since the question is about his research practice. Oct 25 '13 at 5:57
• I'd like to add a Bill Gates quote to Aron Ahmadia's comment: “Measuring programming progress by lines of code is like measuring aircraft building progress by weight.” Oct 25 '13 at 8:42
• @AlexE No one is trying to do this. What Bill Gates is saying, as I understand it, is that as in aircraft industry where people try to make airplanes more lightweight, programmers try to find a way to express themselves more effectively, so the length of the code should not be used to measure productivity. Oct 25 '13 at 9:22
• Here's one more in line with most of the comments here: "The quality of a movie is not determined by a number of minutes it lasts." Yes, but somehow they all end up being around 90 min. except some being 3h long, and some more than 5h (Novecento-Bernardo Bertolucci). Oct 25 '13 at 9:35

You're looking at the wrong metric. In most areas of science, people don't write code at all but still get their papers published. The same is true for more theoretical papers in numerical analysis, proving for example the convergence of a particular scheme.

On the other hand, there are papers that discuss particular libraries or implementations. These oftentimes require writing tens of thousands of lines of code. I have several of those (the one on deal.II discusses what at the time was probable ~300k lines of code, the one on hp methods ~20k, the one on parallel distributed computing and the one on mantle convection each required 10-15k).

In between, there are papers that are more about the development of algorithms. Again, I have several where we got away with just a few hundred to maybe 2-3000 lines of code.

So I feel that your question is not well posed. It's not that you get a paper published because you wrote so many lines of code. Rather, it is what you do in terms of theoretical development plus what you can show with your code that determines whether the paper will be published.

• People from computational science know that in most areas pf science people don't write code at all but still get their papers published, that surely influences the process. Oct 25 '13 at 5:59
• You get an up vote for this answer, you wrote enough lines (tongue in cheek) Oct 25 '13 at 6:09
• I think computational science is no tougher or different than other sciences. If you're in biology, you spend countless hours at the lab bench running your experiments and analyses before you can write up your results. But there, too, there is set number of hours that you have to spend in the lab before you publish. Some papers are just tour-de-force in creating a huge amount of very precise data. Others have a great idea and use a simple experiment to verify it. Oct 25 '13 at 12:33
• Well, we can estimate that on average a computational scientist publishes 1-10 papers per year, on the other hand he/she probably produces on average some 10-100 lines of [debugged] code per day. Then the ratio of # of lines to # of papers can be in the range from a few hundred to a few tens of thousand. Oct 26 '13 at 20:29
• Nice calculation. That encompasses the range I stated in my answer. Oct 27 '13 at 16:03

As Wolfgang said, your metric is wrong. Writing code alone simply isn't ever sufficient to publish a paper. A meaningful paper that is; obviously a lot of garbage gets published. I can think of 3 major areas of computational science publications:

• Numerics: You developed a new numerical method, or otherwise enhanced/modified an existing one. Results show that this method is better in some respect than what exists (faster, more accurate, whatever). This could be as simple as your example of someone changing a closure constant in a turbulence model, or as complex as the invention of discontinuous galerkin methods.

• Physics: You used existing numerical methods to tackle a new/unexplored physical phenomenon. In CFD, this is something like using a wind tunnel to explore a flow problem.

• Software: You developed an entirely new software framework. There's no new numerical methods, but it's a large endeavor and helps development of other work. This is something like Wolfgang's deal.ii framework, or PETSc, or Trilinos, or the various MATLAB publications. They don't have any new numerical methods in them, but they're of obvious utility.

None of these are better than any of the others, but the 3rd example there is unquestionably the least common. No quantity of code by itself justifies publication, and frankly most of the old guard in computational physics doesn't care about code at all - it's just a necessary evil. Examples of things that may have a lot of code, but IMO aren't worth publishing:

• You wrote 500k lines of code essentially duplicating the content of Fluent's theory guide. You can tackle all the same problems, but there's no new numerics or applications. My former advisor would call this "an academic exercise".

• You coded up every single example out of your favorite CFD textbook, or a bunch of papers. The number of lines you coded simply doesn't matter because it simply doesn't contribute anything to discourse in the field.