- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Research: Programming Style and Productivity
Created by bagwell on 2009-08-28. Updated: 2009-08-28, 11:08
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.