Crisis of Choice (software, not an actual crisis)

I’ve been writing Scala code for about 9 months now daily.  I just recently completed (as much as one can complete software) a small project at work that took much longer than expected due to things that didn’t seem like they should take very long taking an eternity to figure out (Marshaling and UnMarshaling data is a huge pain in the ass using spray-json.  I highly recommend fasterxml if you don’t want to waste shitloads of time battling the library itself.  It works like the Play libraries, which is nice.)

Once I get things working, they work reasonably well, although I feel like what I have built is fragile.    Things that should be easy are a huge pain in the ass.  It’s been running for 30 days with no problems, which is nice, but that’s mostly because Akka is solid.  I just don’t feel like I have my head around this language.  I was a dumbass and decided that using a web framework for what I was doing was overkill, so I tried to build it with Akka, Spray, and Slick.  It was a waste of time, other than for learning Akka/Spray/Slick.  I should have stuck with Play and used traits to make testing my code easier.   The previously mentioned huge pain in the ass (which I never did get working) would have never occurred, it just works in Play.  My primary complaint about Play was it was hard to test, but that was actually my problem not really understanding how useful traits are when it comes to testing.  Anyway, you live and learn.

It’s an interesting place to be.  Nine months seems like it should be enough time to grok a language; however, I still feel like I’m scratching the surface.  I’m not expecting to be an epic badass at it, but it’s harder than it should be.  I have the same feeling with Scala that I have with C++.  If I can’t get the bulk of the language into my head, I have much less confidence in what I am writing.  I think that makes me a weaker developer in some ways, but at the same time, the point of abstraction is to not have to worry as much about what’s going on within the abstraction.  Scala is so complex with its generics implementation and type system and every other thing it tries to throw in, that it just gets out of hand in a hurry.  It is an amazingly powerful language, and overwhelming because of it.  It feels like it has created a whole new set of very complicated problems for me to solve to do what should be less complicated.

Scala offers all kinds of badass ways to get concurrency and parallelism and a neat type system, but at the cost of being a really really complex language with a seemingly insurmountable amount of concepts and associated buzzwords.  I blame the JVM and the JVM community at large.  They love abstractions of abstractions with abstractions in them, wrapped in Lists of Generics, which are type erased so you can’t tell what is inside of them at runtime without writing a bunch Manifest or TypeTag bullshit, each with a different name depending on the order that the abstraction occurs.  It’s maddening.  The JVM is amazing, and also drives me nuts.  I’m starting to feel like the “solution” causes more problems than it solves.   I think I’ll always be a JVM outsider.  It just always feels a little wrong to me, even when it’s working (and gobbling up memory).

To put it in perspective, I rewrote my Scala app in Python in about 4 days using Falcon.  My Python version handles the load it needs to and actually uses less memory.  It won’t scale at even a fraction of the scale of the Scala version in its current version, but it doesn’t need to.  If that became a requirement, I’ll bet I could write it to scale in less time than it took me to write it in Scala.  Admittedly, I have been writing Python code for much longer, and since I already had the design worked out, reimplementing it is always easier than the original implementation.  I also used a framework, so it’s not as fair of a comparison as if I had used Play.  It isn’t 86 days easier though.  I’ve been looking at Go and it tries to solve the concurrency/speed/memory/complexity problems in a kind-of backwards way that is interesting to me.  It doesn’t have classes or generics, and I kind of love that idea.  They tried to intentionally keep it simple, which is the philosophical opposite of Scala.  It’s a get-shit-done language instead of an academic language.  I’ll give it a try at some point.

I’m not giving up on Scala.  The challenge is fun; however, I don’t think it will ever be a dominant language.  I don’t think it will every be possible to scale a Scala development team in most cities.  There just won’t be enough people that are actually good at it that don’t cost a fortune.  What do I know though?  I could be wrong, but it just doesn’t feel right to me.  Maybe it’s better if you love the JVM, I really don’t know.  It’s a very complex language though, and I’m not settling on it as the best way to tackle concurrency/parallelism problems.

Ch Ch Changes…

I’m working on a new project now, which has been gobbling up my time.  Consequently I have moved over to WordPress, so that I can focus my time more on the project and less on developing yet another blog platform.  If you haven’t checked it out, Ashley is doing some incredible work.  What was originally intended to be wedding calligraphy has become a whole bunch of different things.  She’s doing wedding calligraphy of course, but she’s also doing maps, family trees, Christmas cards… It’s pretty awesome.  Surprisingly, she’s had as many international customers as she has local customers.  It’s pretty awesome that a little shop in Denver can get clients from all over the world.  The site is running well, and there has been an unexpected extra benefit to moving over to WordPress.  Because it isn’t running on the JVM anymore, the memory requirements have suddenly become very modest.  That means I can move to a cheaper VPS solution.

I moved this site, and all of the others that run on my servers, to the cheapest digitalocean VPS service, and they are running really well on ubuntu/nginx/php/mysql.  $80/month vs. $5/month.  Not bad.  Technically, their response time is about 20ms slower than my linode server; however, that’s most likely due to the new servers being in NY instead of in TX.  The load times appear to be about the same.

I haven’t had to deal with their support, but it was really easy to get things up and running and it took me about 4 hours to configure the server from scratch and move 13 sites over to it. I know that isn’t fast, but I didn’t have any of it automated because I hadn’t really planned on moving it, so lay off me.  Overall, I am pretty stoked about digitalocean and their pricing.  I hope they’re making money and can keep up what they’re doing.  My VM will probably fall over if any of the sites get slammed, but for $5/month, I’m willing to take the risk.  I’ll upgrade if I need to (and it looks like it would be pretty easy to do).


I’m a sucker for formatting.  I follow the python PEP-8 religiously when I write python.  The Scala style guide isn’t as dogmatic though, which isn’t good for someone like me.  I like having some rules.  Anyway, I’ve been writing decent Scala code; however, I’ve not been confident in my formatting choices.  I’ve been getting more confidence through a Scala Coursera class I’ve been taking, but even with that, I just wasn’t positive I’ve been doing it correctly.  That has now changed.

I was just recently turned onto scalariform by a coworker.  It basically checks/fixes your formatting on compile.  It’s completely configurable, but so far I’ve just left it alone.  I set it up to check any code I compile with sbt.  Between sbt, scaliform, and intellij, I’m feeling a lot better about how my codes looks.

What I like right now

I’ve been working a lot with Scala over the last few months, both at work and personally.  If you get a chance, check out  It is the new site for my girlfriend’s company.  She does custom calligraphy for weddings and events.  Her work is amazing.  It’s almost the exact opposite of what I do.  While I sit around beating my head against machines, she fashions these beautiful organic handmade creations.  It’s awesome.  We collaborated on the site.  I’m not much of a web developer, so she did all the design in illustrator, and then I coded it to get it working.  It turns out that the two of us make one half-decent web designer.  In any case, check it out.

The reason I mention it here is because the entire site is done in Scala against a PostgreSQL database using the Play Framework.  It’s running behind nginx on Ubuntu which is running on a Linode VM.    I guess that makes it a LNPS stack, which just rolls off of the tongue.  It’s been a lovely experience.

First off, Linode is awesome.  They totally get out of your way.  I feel bad for not having more to say about them; however, they are so good that I hardly notice that they are there.  I mean that in the best way possible.

Second, nginx is awesome.  It’s small, it’s fast, it’s wicked easy to configure.  I have it serving a bunch of blogs (including this one) which are WordPress sites,, etc. and it just works.

Third, Ubuntu Server is awesome.  It’s small, it’s fast, it’s wicked easy to configure.  I tried using Ubuntu as my main OS on my Dell laptop for work for the last 3 weeks and it’s not my favorite.  I’ll write about that some other time, but I like Server quite a bit.

Fourth, Play/Scala is awesome.  It’s as simple as it can be, and no simpler.  It’s a joy to work with.  It integrates with intellij (which is also an awesome piece of software).  It doesn’t use an ORM!  That might be my favorite part.  I write SQL, and it blazes.  It doesn’t get on board the java abstraction boner wagon.  The main reason I almost never write Java is because it feels heavy and slow.  It abstracts away things that people should probably understand if they are writing code.  I like a certain level of abstraction though, which is why I don’t program in C or C++ much.  I don’t need everything abstracted away though.  Play is a good balance and so far I really enjoy it.  Scala is mostly what makes it awesome.  There is part of me that still things the erlang vm is the way to go, but I’ll have to wait until I have more time to play around with it.  In the meantime, I’m getting things done with Scala, which is nice.

“How do I add an additional implicit extractor and actually use it?” he vomited.

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.