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 DenverDesignStudio.com.  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, DenverDesignStudio.com, 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.

Scala… badass

I have a few friends I talk to about coding.  They’ve listened to me talk up Python in every way except for it’s multi-threading capability.  Writing multithreaded apps sucks.  I can do it, but it isn’t fun.  I get the same feeling about my multi-threading code that I get about my C++ code.  It works, but I always feel like I’ve made a mistake that will come and get me in the night.  I wanted to try the actor model so I gave Erlang a solid 90 days and found it to be an incredibly frustrating experience.  Erlang is neat, but the syntax never felt right to me.  It’s probably my fault for not being smart enough.  People talk about how stable Erlang code is.  I kind of wonder if the barrier to entry is so high that idiots like me don’t ever get far enough with it to go on to write bad code.  Erlang’s success actually has less to do with the language, and more to do with the type of people that grok it.  I’m half joking.

I then looked at Scala because its syntax is more pythonish, but it also allowed me to write functional code when I wanted (I love list comprehensions.  I seriously dream about them).  It also allowed me to use the actor model.  It runs on the JVM though, which historically has driven me crazy.  In my career, I have spent an enormous amount of time debugging java code.  I don’t know if it is the JVM, or java developers, but something about it annoys the hell of me.  There is nothing more annoying than chasing garbage collection bugs and memory leaks on the JVM.

Anyway, Scala (and SBT) make me appreciate the JVM more.  The language is huge and complicated, but you don’t have to know it all to start using it.  The language is still missing a few things (file writing and automatic resource management), but I found libraries to cover those (scala-io and scala-arm) and they work perfectly.  Another one of my gripes with the JVM is dependency management and classpath bullshit, but SBT makes it relatively easy to keep straight.  I installed an SBT plugin that allows me to build jars trivially, and another plugin that builds my Intellij projects automagically, and it all just works.  It works so well, in fact, that I’m starting to like it more than I like python if my code starts getting larger than 100 lines or if it has multiple files.  Dealing with XML in Scala is a dream compared to Python.  My Scala code is concise and easy to read (and fast).  I’m sure the JVM will still annoy me, but the language is such a joy to use that maybe I won’t mind as much (and maybe scala will help me write better code).

Writing multi-threaded code is much better in Scala, I do really like the actor model.  I am probably not writing idiomatic Scala yet, but I’ll get there.  Anyway, after only a few weeks with Scala, I am really liking it.  Hopefully it will stay awesome.

Back on Mac

Well, I’m back on a mac. It’s like a weight has been lifted off of my chest. While I miss the installers that just work on Windows, I don’t really install stuff that often. Everything just works again, particularly the mouse. Windows 8 is great, but until someone builds some really badass hardware, I prefer the mac. The retina display is pretty nice and the track pad with mac gestures is worth whatever the cost difference between a man and pc is. I’m running windows 8 in a VM for my windows specific stuff, and I can use my mac gestures. It’s the best of both worlds. Anyway…

Damnit Microsoft (Skydrive appears to be cool, but actually blows)

I write a spiel about windows 8 and how much I like it, and then you go and suck start a leaf blower when I wasn’t expecting it.

I switched from Dropbox to Skydrive a while back.  It seemed to be exactly the same as far as features, but half the price and somewhat integrated with windows 8.  Then I tried to share a folder with someone.  What an abomination.

In Dropbox, if you share a folder with someone, it shows up in their dropbox folder.   They can edit files or add things or whatever, and as soon as you have an internet connection, you see what they did.  It happens nearly in realtime if your internet connection is fast.  This makes it so you can share a folder with someone, and work on whatever is in that folder with someone easily.  As long as you’re not both in there at the same time, you can make your edits and changes and it uploads it to the cloud behind the scenes.  As soon as they log in, they can pick up exactly from where you left off.  It’s sick.

Skydrive doesn’t let you do that.  It makes you manually log in and upload and download files.  Worse yet, it doesn’t let you upload folders to a shared directory.  I have to create directory structures, and then upload each file to those directories.  It’s so frustrating.

Let me tell you why this matters to me.  I work on music with my brother and some other people.  He lives in Oregon, I live in Colorado.  He shares a folder containing the song he is working on with me, and I open it up, mix it, record my parts, and then close it.  He can then open it up on his end and hear exactly what I did.  It’s brilliant and requires no special software.  It works in Dropbox and I never thought about it.  It just worked so well I never figured it could work any other way.  That’s the mark of brilliant software.  In Skydrive it’s a complete manual mess.  Microsoft already got my $50, so I can’t get that back.  Dropbox will be getting their $10/month for 100GB from me now though with no complaints and Microsoft can suck my skinny white ass.

It’s difficult for me to express how irritated I am.