Sunday, April 6, 2014

I wish I could Scala

I've decided on my next project. I'm going to build a website that my wife and I can upload our photos to and have it store the photos and a database of metadata about the photos. Basically instagram but without the internet. It should be a pretty simple thing to hack together - I have half the code already written in Twit-arr. It will allow us to take out photos from our various devices (two phones and four+ computers) and put them all into a single spot that I can back up.

Since I've been wanting to use Scala for something and have been playing with it here and there, I decided to fire up Typesafe Activator and start a Play project.

Unfortunately I now realize that plan was a mistake.


From the little I've explored, Play seems to be a really neat framework. Controllers, views, config - they all make sense to me. Even constructing JSON - something that is really not trivial in a statically typed language - is straightforward.

And Activator takes much of the pain of versioning away from Scala / SBT. It makes starting and running a project MUCH easier, without all of the difficulty of navigating the morass that is the Scala ecosystem. Were I building a standard Play webapp, I probably would have been fine. But I want to use Redis, and Redis is not typical Play webapp.

There is a Play plugin that uses a Scala library that wraps a Java library. But you have to integrate the plugin into your project.

This is the problem with the Scala ecosystem. There are fourteen ways of putting all of the pieces together. And they've all drastically changed multiple times. And some of them make no sense. And there's no documentation. And since they're written in Scala - every single one of them makes use of a compact DSL that you can't describe in English.

So in order to use this plugin, I have to add the plugin to a Play plugins file, add the library to an SBT build file, and then dig through the source to figure out how to configure it, because the "example" doesn't do any configuration at all.

After all that, the plugin doesn't work. I have a generic "library not found" error, and nothing else. As far as I can tell, the configuration is correct, but it just doesn't work. And there's no easy way to trace it through the ecosystem to figure out why it doesn't work. I'm left sifting through various websites trying to find someone who has just exactly the same problem as I do and managed to solve it. And I don't have the vocabulary to even ask the question I need to find the answer I'm looking for, because the build tools all have different definitions for things.

I know that Ruby and Rubygems weren't always a coherent ecosystem. But they are today, and it makes life easy. So many people have worked through building up Ruby apps, and contributed patches that smooth out the various rough spots that it's now easy to connect libraries into your Ruby code.

With Java 8 out, the killer feature of Scala is its extensible type system. And it's something that I really want to use. But honestly, it's easier to build a Java / Maven application than it is to build a Scala / SBT app.

I want to like Scala. I really do. I wish they'd hurry up and make it easy to use.

No comments:

Post a Comment