Yesterday I was working with Play, and was trying to use it against a mysql database using UUIDs for the primary keys instead of integers. MySQL half-assedly supports this, consequently, everything that uses MySQL treats it as a corner case. I switched to PostgreSQL to see if it worked any better (it has a UUID primary key type). Of course, because MySQL treats uuids-as-primary-keys as a corner case, there is no implicit extractor for the UUID datatype in Play. That’s to be expected because, apparently, no serious engineer would use uuids as primary keys (it’s hard to talk with your tongue so firmly jammed into your cheek), and since Scala and Play are supposed to be so cool and flexible, problems like that should be trivial to solve… Unfortunately, I was unable to find any real documentation, and more importantly for me, any examples, of how to add implicit extractors in Play. I was up a creek.
I posted a question to StackOverflow and went home. I was so irritated at something that should be easy that I rewrote a large enough portion of my app in Erlang using Chicago Boss. Chicago Boss has an ORM, which I am not crazy about, but it also lets you use uuids as primary keys in PostgreSQL without and hackery, which is cool. I got it working in Erlang/Chicago Boss, and then came in this morning to find a response to my StackOverflow question. The answer was so easy and clever that I was pissed off that I didn’t see it. If you’re curious on how to do it, go here.
This is what it is like for me using Scala. I read 50 articles on monads and beat my head against scalaz wondering why anyone would choose this language. And then I see someone solve a problem with the simplest little bit of code, and I am willing to forgive the language for being so complicated. That being said, once I get this stupid thing off and running, I’m building an Erlang version if I get a chance, just to compare the two. I’m dubious of the Java world and their disrespect of memory, and their insane abstractions on top of abstractions with abstractions in them, as well as all of the inane terms they come up with to explain those abstractions. After all, when you have to create the title of this post just to ask a question about a concept, the language might be a little bit more complicated than it needs to be… or not. Only time will tell.