This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Research: Programming Style and Productivity

Assessing the effect of different programming languages and programming styles on programmer productivity is of critical interest. In his paper, Gilles Dubochet, describes how he investigated two aspects of programming style using eye movement tracking. He found that it is, on average, 30% faster to comprehend algorithms that use for-comprehensions and maps, as in Scala, rather than those with the iterative while-loops of Java.

Interestingly, he also finds that for within small scopes, 2 to 16 lines of code, there is no advantage to having intermediate variables with "comprehensible" or "meaningful" names: Dense code with no such names, using arbitrary short names, is just as good.

There is a well established understanding that moving from assembler level languages to languages offering higher levels of abstraction results in significant gains in productivity, described, for example, in an empirical comparison of languages by Lutz Prechelt. Gilles finding, that subjects take a constant time per token read, suggests that a significant part of this gain should be attributed to language conciseness.

Experience with Scala shows that it typically takes one half to one third of the lines of code to express the same application as Java yet executes at about the same speed. From the research it also appears that Scala better matches the way programmers think, and it seems to be a view supported by experienced Scala programmers too.

Alex McGuire, who writes mission critical projects in Scala for power trading companies, says of Scala "The conciseness means I can see more of a program on one screen. You can get a much better overview. When I have some mathematical model to write with Java I have to keep two models in my head, the mathematical model itself and the second a model of how to implement it in Java. With Scala one model, the mathematical one, will do. Much more productive.”

With more work, like that of Gilles, the influence of programming style and language design may become more quantifiable.

Gilles Dubochet presented the paper “Computer Code as a Medium for Human Communication: Are Programming Languages Improving?” at the 21st Annual Psychology of Programming Interest Group Conference, Limerick, Ireland, June 24-26, 2009.

Re: Research: Programming Style and Productivity

"Experience with Scala shows" that without refactorings (including integration with Java refactorings) in Eclipse plugin my productivity is 50% lower than with just old, bloated, etc Java code.

Re: Research: Programming Style and Productivity

Odd.  It's faster for me to write Scala code and port it to Java than it is to write it in Java in the first place.  It might be harder to refactor for now, but it's so much easier to make changes that do modify behavior.  Also, so many things are easy in Scala that are impossible or painfully difficult in Java.  I only had two weeks of experience in Scala before I switched over all my personal projects, and I've never looked back after more than a year with Scala as my main language.

Re: Research: Programming Style and Productivity

I don't know why you have time to write something one time on Scala and then port it to Java (i.e. write second time). I don't have free time to do this. I don't have also time to update manually identifiers after rename refactoring performed in Java, or even just update them manually when I want to rename function in Scala.

 

I want to use Scala, but without good Eclipse plugin all these words about how productive programmers with Scala are just marketing words which I ignore.

Re: Research: Programming Style and Productivity

I agree, Konstantin. The numerous lectures/papers Mr Odersky, Venners, etc. have done over the years have gotten me excited about Scala, but without strong IDE integration I can't invest a lot of energy in using the language on an enterprise project. The current state of Scala integration in Eclipse, IntelliJ and Netbeans is not sufficient yet.

 

From what I've read, developing powerful IDE support for a language like Scala is much more difficult than it is for Java. That said, I think the future success of the language (outside of academia) depends almost entirely on the quality of the IDE support.

 

If I were someone from whom the success of Scala was important, I'd do my best to get a skilled team together to develop _one_ excellent Scala plugin - probably for Eclipse. As the plugin attained acclaim, developers would begin to use it in earnest and eventually trust it enough to propose the language's use for their company. (I know I would.)

 

The current generation of new languages is probably the first that will require more than just a good specification and compiler to become the "next big thing". Extensive IDE support is a must because professional developers have become (rightfully) dependent on the features they provide.

Re: Research: Programming Style and Productivity

I second that. Forget Netbeans, Eclipse is where it is defacto at. No powerfull plugin and you can join the other (dynamic) languages. I would expect a "Rerouting all energy to create kickass eclipse plugin", but haven't seen that happening. No powerfull(bugfree) eclipse plugin = no wide acceptance. It is as simple as that.

Re: Research: Programming Style and Productivity

I agree. An excelent eclipse plugin would boost Scala adoption more than anything else I can think of. Miles Sabin is doing a great job, but I fear he's a bit alone in the task.

Re: Research: Programming Style and Productivity

This doesn't surprise me. With all the bitterness that goes backwards and forwards between the static vs dynamically typed camps I think everyone misses the point. It is abstraction of control structures that aid programming mostly not static or dynamic typing.  My day job is C++ and what I wouldn't give to have access to block based programming as in Ruby and Scala. Trying to do functional programming in C++ whilst possible is twisted and extremely verbose leading to unreadable code. The new C++ standard tries to fix this with the new lambda notation but we will have to wait 10 years or so for the standards comitte to finalize and then all the compiler vendors to come into line and then BOOST to iron out the incompatabilites in the compilers.  :)

 

B

Re: Research: Programming Style and Productivity

I've been using Scala in Netbeans 6.5, I have a difficult time liking Eclipse (Just personal preference), I find my code much easier to maintain and produce.  I am able to write programs much faster with Scala in Netbeans than in Java.

The IDE does have some glitches but works for the most part. Before Netbeans I was using VIM.

I've used many other languages for years and I love Scala.  I'm never going back to Java.  I have a hard time with any other language that can't match all of the features that Scala contains.

 

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland