This is a guest blog post is from Graham Lea, Software Engineer and Team Leader at Tyro Payments in Sydney, Australia.
I’ve been a dishonest blogger, but I’ve paid my dues. Earlier this year I wrote a rather cheeky blog post. I described “A New Java Library for Amazing Productivity“, although I was actually describing the Scala programming language, which also runs on the Java Virtual Machine but adds a functional paradigm. The post was deliberately deceptive, but with a point: I wanted to question the wisdom of making such a clear distinction between libraries, which we seem to add to our applications with not more than a moment’s thought, and languages, which many developers are hesitant to even investigate, let alone adopt. I also highlighted the increasing prevalence of “Trojan languages”, wherein frameworks present themselves as libraries in JARs but actually require learning new languages to be used effectively.
The post got a lot of traction – over 13,000 views by now. Admittedly, much of this would have been among the Scala community, but I also saw some Java-based devs on Twitter sympathising with my main point and encouraging their peers to open their minds to exploring beyond the boundaries of Java in order to increase their productivity.
One piece of negative feedback I received, though, was a blogger who labelled the post “folklore”, adding, “Huge claim… No facts or numbers.” At first I was tempted to flat out disagree: I’d presented 15 features (are they facts?) of Scala that clearly demonstrated productivity gains over coding in Java! Numbers, however, I was short of. Personally I’m convinced Scala is a language that delivers on the promise of getting more things done, but I had never checked whether that view was shared by other people who’d put Scala into practice.
Once I accepted the validity of the criticism, my initial reaction was that I didn’t have the resources to collect the kind of long-term, unbiased data that would convince myself that the productivity gains I claimed had been “clinically tested”. Nothing gets me thinking, though, like the suggestion that something is unachievable. So while I knew I couldn’t collect gold standard data, I decided I could use the momentum from the original blog post to collect at least some data, and some data would be better than none.
I created a survey of opinions with the intention of collecting from Scala programmers their insight into whether they felt more productive in Scala. I also asked a bunch of other questions to collect some demographics about the respondents that I could use to correlate people’s sense of productivity with their length of experience with Scala at home and work and their depth of functional programming knowledge.
I consider the response a moderate success. We managed to get 441 responses to the survey – more than I imagined, but not as many as I’d hoped. Importantly for me, the blogger whose criticism initiated the effort came back to see the results and left the comment, “Great survey and sample about the perception of Scala vs. Java productivity.”
As someone who’s been trying to convince people to switch to Scala to increase their productivity, the two most important things I wanted to learn were:
- Do NEW converts to Scala get an instant productivity gain, or does it take time?
- Do Scala coders need deep FP understanding to feel productive?
While I’m pretty confident productivity will increase for people who stick with Scala, and will increase with more understanding of FP, I also understand the usage Lifecycle and the importance of first contact – if you promise productivity as a core feature and it doesn’t appear pretty quickly, people won’t stick around.
I was pleased to see that the results of the survey supported what I’ve been telling people. When I charted the correlation between productivity and years of writing Scala at home, the two biggest categories were people who had 1 or 2 years of experience and felt they were “a lot more productive”. The results were similar with regard to vocational experience: there were few respondents that had more than a year of using Scala at work, but still most of these reported high increases in productivity.
Most survey respondents with almost no Scala experience said they feel more productive
The results also showed that among those who feel they only have a basic understanding of functional programming (FP), there are still perceived increases in productivity. Perhaps more interesting in this chart, though, was that the majority of people rated themselves as having either an intermediate or high understanding of FP. To me this suggests that people who learn Scala either come with some functional programming knowledge already gained elsewhere, or they quickly develop the view that using Scala effectively requires upskilling in FP and they undertake that challenge.
There is a (self-reported) high level of FP understanding amongst Scala programmers, but those with only basic skills still feel more productive than in Java.
Ultimately, I’m confident concluding that the survey results showed that my personal experience with Scala is a fairly common one:
- Java programmers who learn Scala generally feel more productive pretty much straight away; and
- You don’t need to become a functional programming expert to increase your productivity with Scala.
Both of these conclusion have caveats: reports of productivity come straight away, but the level or reported productivity increased with time. Similarly, for functional programming expertise, the higher productivity levels correlated with higher FP understanding. So, Scala is a library language that provides immediate benefits, but it is also (like most technologies of any depth) one where education in theory and long-term application will continue to extend the benefits.
About Graham Lea
Graham has been designing and implementing bespoke, enterprise-scale, distributed systems for over a decade and has been fostering a keen interest in the Scala platform since 2009. He is a JetBrains Development Academy Expert. Follow him on his blog and Twitter @evolvable.
The views expressed in this blog post are those of the individual, and do not necessarily represent the views of JetBrains.
Image credit: Ferrari 458 Italia by Romain Drapri