iam.guillaume.bort.fr

April 22, 2010 at 8:48pm
home

My thoughts on Scala

Well, I’m not a Scala master. For now I’ve mostly used it to create the play’s Scala module and tested it with small applications. I had the chance to meet some more experienced people and to discuss with them about the best way to use it.

However this first experience was pretty exiting and helped me to understand what could be the future of Scala. Is Scala a complicated language to learn? Yes I think so. But it is also a Scalable Language; it was the goal of the language design and I think it is really the case: it gives some incredible power to framework creators while letting the end-developer dealing with a very simple API (a very clean DSL in most cases).

Applied to play it is the ideal use case. Even if it requires some really tricky hacks in the core of the play’s Scala module it allows to write a web application in a very expressive way;

Most of the time you can just concentrate on your application without having to deal with technical boilerplate. I guess we have already done a pretty good job on the Java API but Scala gives us more power to do that.

There is some features that really saved our life while creating the Scala module. The native singleton objects definitively remove the nightmare of dealing with static members. The package objects allowed us to keep a coherent API between Java and Scala. And of course the implicits make pimping the existing Java API a breeze.

Traits really allow to reuse and mix several concerns in your controllers. And default arguments solve one of the most problematic issues of the play’s controller API;

Of course all these new concepts can scare a Java developer. But really as a play developer you just have to use them. And I think that it is really straightforward.

Finally a simple way to start with Scala and a play application, is perhaps to just use the new ScalaTest feature that allow to write your test case in a very expressive way;

Now there are still small problems with Scala. These are not related to the language itself but to the tooling that is still pretty immature. Even though the Scala compiler is awesome it’s really slow and has some difficulties to handle incremental compilation (even if the new, currently beta, 2.8 release has done huge progress in this area), and the error reporting can sometimes be a little cryptic. 

Anyway I’m sure these problems will be solved soon when the language will gain even more interest. And then using Scala for your projects, specifically with play as application framework will really change the way you will create your next web applications.

I’m pretty sure of that.

Notes

  1. ikeikeredking reblogged this from guillaumebort
  2. guillaumebort posted this