Monday, January 28, 2013

Hello Scalatra!

In the last post, I was gladly touting we were using ASP.NET MVC to be pragmatic. In retrospect, this was a mistake, since we are primarily Linux developers. This lead to intense pain points regarding almost everything we tried to accomplish, since almost all tools and systems assume you are on Windows and using Visual Studio. A lot of work has gone into Mono, but the reality is that it will always be a second-class citizen in the .NET realm. Everything from making sure fastcgi-mono-server could run the software correctly, to remote deployment, to ensuring we were compiling with the right libraries (nuget's command line interface is painful at best) was more tedious than necessary. This is fine. I wouldn't waste time developing for the 0.1% of developers using the tools in the manner we tried to.

Scalatra

The JVM is well-supported on Linux, so we decided to move to it. After that, we went with my favorite JVM language, Scala, since it has the best documentation and a wide variety of web frameworks available. We checked out Lift, Play 2, Scalaz and Scalatra. We ultimately went with Scalatra because it was incredibly easy to get the Rails-like pattern matching up and running and for being fairly well-documented.

Gradle

Almost every Scala project assumes you are using SBT. However, I do not much care for SBT. The biggest issue for me is the support for building non-JVM tools isn't really there. Sure, you can do it by writing your own extensions in Scala code, but it is not terribly clean when compared to something like GNU Make. Furthermore, the decisions for which symbols to use seem fairly arbitrary (not that $?, $+, $< are any less random, but I would like to get away from the excessive terseness of Make). The product is not well-developed enough at this point. It seems like the DSL changes every other version and the only way to get SBT is to compile it yourself (which makes life even more painful if you want non-developers to build).

I suppose the C++ hacker in me prefers a build system which thinks of itself as a DAG first and a specific technology second. Gradle does this extremely well -- the core DSL makes no assumptions about using a JVM language, as it is all implemented through plugins. This allows our system to build all resources through a single system -- including compiling TypeScript to JavaScript, converting COLLADA XML into our own JSON representation and anything else we might want to do in the future. Gradle is quite flexible and fairly mature. Furthermore, Peter Niederwieser, one of the Gradle developers is incredibly responsive on things like Stack Overflow.

The Stack Now

  • Gradle - build system
  • Scala - server-side language
  • Scalatra - web framework
  • TypeScript - client-side language