Grails vs Dropwizard vs Scala vs Go
The title might not make that much sense, but that’s what I’ve been doing for the past few weeks (in addition to an amazing trip to Chicago) - trying to figure out what web framework to use in the future.
I have been using Grails since version 1.1 and have been pretty happy so far. It met the requirements I had for a web framework in the environment I work in. Those were mostly:
must run on Tomcat 5.0 / Java 1.5
development speed > runtime speed
I’ve been using a JSF/Spring combo before that and I really didn’t like the approach JSF uses. Several things changed since then from my perspective including my personal requirements.
From my perspective Grails has been losing steam over the last month and never gained the amount of traction I hoped it would get. The plugin ecosystem might be okay-ish, but it’s by far not on Ruby on Rails-levels. In addition to that Burt Beckwith, author of quite a few plugins and formerly author of the weekly “this week in grails” blog went silent in July. I haven’t checked if he continued to work on plugins, but this still prompted me to finally take the time to look around and assess my options.
must on Windows Server (no NGINX for me :<)
container-less deployment is sexy (I never used any Tomcat-specific configuration anyway) but not a must
if Java then Java 1.7 / Tomcat7
static language, if possible
good IDE support, if possible
Changed web development approach
The rise of the MVC JavaScript client frameworks! Finally web development made sense for me. Not this weird mixing server & client together in one mushy package but a clean separation of back- and front-end. Since I’m not developing public internet apps that need SEO or have low latency requirements I didn’t see any reason why I shouldn’t embrace that approach.
So the main thing the new server web framework needs to do is provide a nice REST interface.
Ruby got ruled out because the deployment on Windows seems to be not-that-mature - or my Google-fu failed me
the techempower benchmarks ruled out Python (and Ruby for that matter). I might not need the speed, but if I choose new technology it shouldn’t be that slow
Node.js is still a bit too “fresh” and it is JavaScript-based - okay-ish language, but not my favourite
same goes for vert.x, but I’ll definitely keep an eye on it
I narrowed it down everything to a few options:
Grails: it works, I know it, it’s reasonably fast and Groovy recently picked up pace according to some language rankings
DropWizard: tailor-made to provide great REST-interfaces, sounds like the perfect fit
Go: great little language, and really really fast
Scala: the new go-to language for enterprise development? Both Scalatra and Play! looked nice and seem to have a lot of traction
I implemented a small proof of concept in DropWizard and I really liked the package the yammer guys put together. However, it’s Java. Coding in Groovy for that long made me forget what a verbose pain Java can be. Still the language with the best IDE support!
Moving back to Grails I was instantly annoyed by the dynamic nature of the language. IntelliJ IDEA is really good with Groovy, but still I missed the type safety from the other languages (I had played around with Scala and Go in the meantime as well). Great job, increased incentive to find “the new thing” quickly.
I think Go is THE future language for PaaS or cloud stuff in general. It’s resource usage is amazing, the deployment is more or less “copy single binary & run”. I think my simple web app uses something like 6mb memory. The language seems to be the opposite of Scala, very lean, only the bare minimum features built in but excellent concurreny support. The Go code you write usually does exactly what you expect it to do. To top that off the compiler is amazingly fast, again the opposite Scala.
However, the eco system is quite young:
the only Oracle driver I could find hasn’t been updated in ages
same with an LDAP library
no mature web frameworks yet (BUT the standard net/http package is quite amazing on it’s own)
In addition to that, the missing generics and sparse collection library make the code sometimes a bit verbose (nothing like Java, mind you). The whole dependency management thing (from my limited perspective a solved thing in the Java eco-system) is ignored, go get always pulls the latest MASTER. Urgh.
I used GoSublime for development and was quite happy with it.
Scala drove me nuts at first. The ability to use nearly any symbol as a method name in addition to the functional part of the language made it really difficult to read code in the beginning. The language feels like every available language feature available got crammed in. This combined with functional programming style seemed to promote “elegant, one-line but unreadable” code.
That said, after I finally figured out some of the functional parts of the language it started to not only make sense, but it was also fun to implement stuff. The collection API, the Option type, immutability - things started to fall in place. Also, the language has access to the vast ecosystem of 3rd party Java libraries.
The language support in IntelliJ IDEA is improving but still nowhere near Groovy level. It’s still very usable from my perspective.
I think I finally settled on Scala. Go is a close second and I will try to keep up with what’s happening, I really liked developing in it and when I’ll ever need to use a PaaS like Heroku etc I will definitely try to use Go there.
Using a Scala-based web framework seems to make most sense for now. There are several great options available, including the Play! framework and Scalatra (which had amazing benchmark results).