Monday, December 19, 2011

I've Got 99 Problems but Scala Ain't One

If you're havin' programming problems i feel bad for you son
I got 99 problems but scala ain't one - Jay Z

OK so maybe Jay Z didn't quite say the above, but there has been some hand wringing lately about the complexity of Scala - just as Scala is showing signs of becoming quite popular.

You can see some of this here, and also some great blogs addressing this bought up by the commercial stewards of Scala, Typesafe here and here.

I thought I would share something about our use and experiences with Scala at CloudBees. We support Scala in various ways, and have many enthusiastic users of it on our platform - but we also use it quite heavily ourselves.

The 2 main areas we use it:
  • Cloud control, allocation of build workloads and Jenkins masters ("providore")
  • The core admin "cloud controller" for RUN@cloud
So you can see this is pretty core stuff. Every app deployed, every build performed, every new user who joins etc... all pass through a significant amount of non trivial Scala.

In the first area (DEV@cloud) - it was chosen as I (Michael) was quite familiar with it - and time is was of the essence - we iterated quickly in working out good ways of interacting with cloud apis (through jclouds - which worked out of the box). Good automated testing tools (Mockito, Scalatest) proved invaluable - as did a really great command line for "live" testing and modifications. Keeping the code compact also helped (lots of higher order functions working over lists and maps going on).

In the second area - RUN@cloud - in parallel Spike built the cloud administration (controller) in a very similar fashion for very similar reasons (we didn't even know each other at the time) - with great results as well.

In time - others joined in - and have been able to contribute and comprehend the code - without too many issues. Scala may not be to everyones taste but it certainly proved to be no roadblock at all for us so far.

We have avoided (partly by accident, partly by design) too many dependencies on libraries that are written in Scala - avoiding most difficulty in updating versions. We also deploy these particular applications as services (that communicate via HTTP, AMQP etc) - not as libraries to be consumed by other JVM apps: perhaps it is the lucky combination of these two points that explain why we did not feel the "pain" described above.

In any case - we are excited by what Scala offers - libraries like Akka are quite an achievement, the Play! Framework, and more - all made richer by Scala. Typesafe are an exciting company and look like they are building a fantastic stack for the future too.


Hopefully there will be many ways we can help the Scala and wider community address these growing pains - for example ensuring the Play Framework v2 Keeps It Clean - for multiple versions of the JDK. There is even talk of matrix builds in Jenkins for many Scala libraries and versions.

The future seems bright - for Scala as well as all JVM languages.

CloudBees
www.cloudbees.com
 
Follow CloudBees:
Facebook Twitter

1 comment:

  1. Scala is really amazing, and the way it integrates with Java is really the way to go for languages built on top of the JVM. I had recently made an astonishing discovery, testing my own library in a Scala environment:

    http://lukaseder.wordpress.com/2011/12/11/the-ultimate-sql-dsl-jooq-in-scala/

    jOOQ is a fluent API for SQL in Java, aimed at people who feel more at ease with SQL than with any other querying abstraction (such as JPA / Hibernate), but who still want querying typesafety instead of String concatenation (JDBC / iBATIS / Spring Data). Seeing it run right away in Scala with an even nicer "fluent feeling" was quite a positive surprise!

    ReplyDelete