Saturday, February 8, 2014

The Case for Adding Scala

Scala is a language that I have been examining for awhile. Early on the library versioning issues really turned me off, but the seem to have been solved. It's also a very large language that requires programmer discipline to not abuse. Twitter has been a big proponent of Scala and the Effective Scala document is a great start on how not to abuse the language features.

This post argues against Scala in large projects or in mixed projects. The points made about tooling and interoperability I think have for the most part been fixed since the post was made in 2010. Intellij works great with Scala and intermingles Scala and Java in the same project without any issue.

One of the big points that is made in the post against adding Scala is that it raises the bar for someone to contribute to a project. While is does raise the bar, is Scala really the straw that breaks the camel's back in this case? Any modern Java project is already going to be loaded with Java, Spring, Hibernate at a minimum. I also wouldn't write any Java without using Guava and the components it provides like immutable collections, predicates and options.  Do those also raise the bar too high for a new contributor?

The post also argues against multi-language projects. Again, every project is already multi-language. Java, SQL, HQL, HTML, JS, SpEL to name the common ones. Scala appears to get singled out because it can be abused. The problem with that line of logic is that any language can be abused. Project standards are key anytime there is more than one developer.

So, after some discussion we are including Scala into our Java projects. I view it as an easy way to evaluate if Scala can work for us. I also think (hope) that in the long run Scala can become our language of choice for working on the JVM.




No comments:

Post a Comment