29

There's a widespread belief among that the more dynamic and loosely typed the language, the more productive the programmer will be in it. Guido van Rossum wrote about programming productivity using python in 1998 and searching around the web I still see people referencing this exact claim:

Syntactically, Python code looks like executable pseudo code. Program development using Python is 5-10 times faster than using C/C++, and 3-5 times faster than using Java. In many cases, a prototype of an application can be written in Python without writing any C/C++/Java code. Often, the prototype is sufficiently functional and performs well enough to be delivered as the final product, saving considerable development time. Other times, the prototype can be translated in part or in whole to C++ or Java -- Python's object-oriented nature makes the translation a straightforward process.

Has this issue been properly scientifically evaluated? If not for then perhaps for sibling scripting languages like , or ?

I'm not looking for rationalizations, analogies, or explanations why it could potentially be hard to answer, unless it's the opinion of researchers or experts that has taken the time to look into the issue.

I initially asked this question over at skeptics.SE, and someone suggested I should ask it here too.

Kit Sunde
  • 402

5 Answers5

19

Ousterhout's article1 about scripting languages suggests that the higher level the programming takes place, the more productive the programmer is. If we take that, as Boehm says2, the number of lines a programmer can write in a given time is constant and not dependent on the language or its type (low level, system programming, scripting), one can easily believe the claim. The resulting instructions-per-source-code-line -ratio can be an order of magnitude (or several) better with scripting languages than with system programming languages.

As scripting languages heavily rely on ready-made utilities for common tasks (e.g. data structures, string manipulation), their main use usually is to enhance productivity with the cost of slower running speed by providing a syntax that's easy to learn and efficient to upkeep programs with. One doesn't resort to a scripting language when top execution speed is needed.

[1]: J. K. Ousterhout, Scripting: Higher Level Programming for the 21 Century, Computer (IEEE), 1998
[2]: B. Boehm, Software Engineering Economics, Prentice Hall, 1981

Jawa
  • 292
8

If you measure productivity as "time to write a specific simple program" then it depends so much more on programmer experience and quick mind than the language that you are really evaluating the programmer, not the language.

I believe timed code contests indicate that the language doesn't really matter for those kinds of tasks. There is no one language that wins such challenges easier than others (at least not if you allow for the relative popularity of languages).

If you measure performance as "the effectiveness of the best program" written in a given language, then it's even less language-dependent. See for example the results of the Galcon AI contest. The winner is written in Lisp. The next Lisp entry, however, is ranked #280. What does this tell us about the language's suitability for writing great AI efficiently? In my opinion, nothing. It just tells us that "bocsimacko" came up with and implemented the most effective algorithms. For the record, time was not a major factor in this contest - people had more than two months to develop their code.

Lastly, if you measure performance as "long-term cost of maintaining a project" then I think you're onto something. Especially if you hire only the best people for the job, and count cost in man-hours rather than dollars. I have a strong opinion on which languages are best for this, but having no hard evidence to link you to I'll leave this opinion out. Perhaps someone else has links for this type of performance.

7

http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprtTR.pdf is one of the few studies which I am aware of that did an actual direct comparison between productivity in various languages. It is old, but worth reading if you find the topic interesting. The comparison has a number of major shortcomings which the article is very honest about.

The overall result is that low level languages (eg C, C++) take longer to write, can take much less memory, and can run much faster. But with very high variability. High level scripting languages tend to take half as long to write and have less variability in approach. To an initially surprising degree, there does tend to be an obvious way to do something in a scripting language.

Note that all performance numbers for Java should be taken with a major grain of salt - the paper was produced in the 90s before people had a lot of experience with Java, and before the JVM was well optimized. Both factors should have significant impact.

btilly
  • 18,340
1

To put it generally, writing a program in Python will usually be faster than writing the same program in C, C++, Java.

It is also likely to run slower.

There are, of course, particular applications for which other languages may be quicker because certain tasked involved are 'more natively' supported.

While I am not aware of any studies to confirm this increase in speed/productivity (as one commenter mentioned, this can be tough to measure precisely), there has been direct research into the expressiveness of language.

I think there is some merit to a correlation between language expressiveness and programming speed. Just picture a simple iteration pattern and how a Pythonic for-loop or list comprehension can be more succinct. Not only can it be immediately typed faster, but it also eliminates concerns of off-by-one errors, indices out of bounds, and other such problem that can significantly slow the coding process.

This shows a table an estimate for expressiveness ratios of languages. While it should be taken with a grain of salt, the footnotes it mentions are very worthwhile.

http://en.wikipedia.org/wiki/Comparison_of_programming_languages#Expressiveness

-5

Last time I used Java (a while ago admittedly) it took a screen full of code to open and write to a file. Compare that to a couple of lines in Python or Perl, and you can guess which one is faster.

Obviously languages all have their own strengths and weaknesses, but for most tasks Python will be faster to write.

wobbily_col
  • 1,891