Scala: the Case for Correctness
It’s only a matter of time before Java shop managers are faced with eager developers trying to push a new language on them. It’s a hard sell. Java has mature tooling, tons of documentation, countless stackoverflow articles, and lots of senior developers available to fill vacancies. Combine that with your team’s expertise in Java and the rampup cost for a new language, on a project that was supposed to be done yesterday.
Needless to say, the benefits should be substantial enough that the investment is worth it. The typical selling points developers are going to throw out are the concise syntax or the functional programming but for me the biggest benefit with Scala is correctness.
Introducing Objectify for Scala
It’s a framework we developed almost a year ago, that has been running in production for over 10 months. It’s so simple and effective that we have barely had to make any commits to it since. That framework is Objectify.scala.
Objectify was inspired by James Golick’s framework, Objectify. He introduced it by describing why Rails needs to move away from fat models, and create a service layer. In a sense this a move towards the Java/J2EE way of creating applications and it’s something both Joe and I agreed with.
When looking at our own codebase at the time, which was built on Scalatra (a Scala port of Sinatra), there was definitely a lack of organization and structure. Since the application had become fairly complex, the way the Scalatra routes were separated into files and policies enforced, was mainly using inheritance and traits. We didn’t feel that this was a scalable solution for our architecure going forward.
We decided to create a light-weight framework, based on Objectify.rb, to help us structure our Scalatra application. In particular, the key features that we developed to do this were dependency injection and policy management.