Scala needs tools that scale like the language
I’ve been getting into Scala recently, as a half-way house between Java and more dynamic languages like Ruby.
But there’s one thing which seems to stick out. All the Ruby tools I use are pretty simple. Rake, RSpec, Capistrano. All this stuff is lightweight and doesn’t get in the way. Scala seems to inherit by default too much of the Java ecosystem. The language is lovely and I can now churn it out in text editors like Vim or TextMate rather than needing to use an IDE, but the tools leave something to be desired.
Build tools seem too complicated, for a start. There seems to be two choices: Maven and simple build tool (SBT). Maven is poorly documented and has all the worst excesses of Apache. I thought I was just a freak until I start seeing Java people - nay, even Java Enterprise people who work on stuff like JBoss - telling me that they hate Maven too. When you start a project and you’ve got to write out an eight-line mvn command with archetypes and URIs and version numbers. Fuck that.
There’s this annoying attitude in Javaland which goes like this: our software is complicated, so we need an IDE. Now, because we have an IDE, all our build software needs to work with the IDE. What? You’ve got a simple solution? It doesn’t work with our IDE, which we must use because we’re doing complicated stuff. It’s a cargo cult. It’s complicated because, well, it’s got to be complicated. If it isn’t complicated, then something is wrong. I really don’t get this attitude. Someone call William of Ockham and get him to bring the damn razor.
So I started using sbt. Mostly, it’s better. The output is still ridiculously verbose. And the best way to see this is to look at this comparison I posted. It shows the output from running some tests in Ruby with the output from a similarly sized set of tests using ScalaTest. Look at that output. There’s only two things you really care about with testing: whether or not the tests pass, and what causes the tests to fail if they do. If the tests pass, you can tell me so in less than 55 lines. On my screen, my terminal is usually 179x42. Less if it’s on a netbook.
The advantages of Scala that I particularly care about are speed, Java libraries, better FP constructs and having a less clumsy type system. Basically, being able to do def foo(x: String) rather than def foo(x). Or to have the compiler do it for me. And being able to do stuff like List(1, 2, 3).map(_ * 2). Most of all, being able to do that and have it run very, very close to Java speed rather than at Ruby speed. Liking those things doesn’t mean I should tolerate arcane tools. A lot of Java programmers look at Scala and say “Yes, very nice, but it needs better tool support”. What they mean by that is that Eclipse or NetBeans needs better support for Scala. I look at Scala and say “Yes, very nice, but it needs better tool support”. But what I mean is that it needs simpler testing libraries and it needs a build tool even less like Maven and even more like Rake - or even make. With Scala, unlike in Java, we’ve got a clean slate. We can ruthlessly apply You Ain’t Gonna Need It.
I could tolerate Maven if I was building a massive application. But if I’m building a tiny script, Maven is like using a broken, badly-designed version of the drills they used to dig the Channel Tunnel rather than a craft knife. sbt is only marginally better.
Scala advocates - myself included - believe that Scala is a “Scalable Language”. It’s good enough both for writing large apps (like Java or C++) and small scripts (like Python, Ruby or Perl). The question is whether the tools that go with it are similarly flexible.