Will Roe’s blog

A variety of geekery » Archives

What Makes a Developer Happy?

Today was a pretty good day for me - programming-wise. Even though I wasn’t too well (having trouble hearing in my left ear which is disorientating and makes conversation difficult), I feel the contentment of a day well spent.

So what made it a good day? Building stuff is the bottom line for me but that is a very broad term. Today, building stuff meant working with the Raphael library to make a graphic for a web app (a dynamic graphic, it’s not just a logo); refactoring the backend of said web app and reading various tech news.

News first. I was mainly reading about the architecture of Datomic, which is a really interesting take on databases. I would say it looks like the most developer friendly database implementation (in terms of the aims of the project) combined with some pretty powerful and flexible storage. I’m not sure how deploying it would work out, given it uses SQL or some other key-value-capable backend so it really adds another layer to your app’s architecture. The rationale page was music to my ears though so I will be trying out the free edition for sure.

The refactoring I worked on today was a bit of “technical debt” that had been hanging around for a while. It was as a consequence of not understanding how to split up and compose together templates (and partial templates, snippets) with enlive. I had another go at reading the tutorials and this time it just felt easy. They could definitely do with simplifying though. The reason this was so enjoyable was that writing and refactoring Clojure code is generally a very fun endeavour. I generally have a SLIME session open with emacs and I just recompile the code or compile the function I’m changing, then check those functions in the REPL in emacs. In other words, development can be very fast. Also, enlive is hands-down the best templating system I’ve ever used. It’s great that it can be used both for templating and for web scraping (or in my case, integration tests checking the contents of DOM nodes).

Working with Raphael for creating scalable graphics is also really fun. Previously I had tried out Paper.js (which is an abstraction over HTML Canvas). There were a couple of problems with Paper.js. Firstly it is bizarre - the documentation is somewhat held back by only showing examples of so called PaperScript, which I couldn’t see how I could use. It’s essentially Javascript with a bunch of functions added to various prototypes by the looks of things. The issue was I am rendering one graphic per item in a (more-or-less) 100 length list and I couldn’t see a simple way to define one PaperScript thing and feed it parameters to draw all the slightly different versions of the graphic. I decided to try out Raphael and immediately found it vastly simpler for defining the sort of simple shapes I needed to draw. Raphael is a small javascript library for generating SVG (or VML where that is supported). The biggest downside of using Raphael instead of Paper.js is that, according to What can I use… the Android browser only started supporting SVG in version… 3.0!!! That truly does deserve multiple exclamation marks of sheer disbelief. Google, the open web? Really? That means, according to the Platform versions page on the Android developer site, as I write this, over 85% of Android users are on 2.x or lower and SVG won’t work in their default browsers. SVG is pretty damn old - initial release in 2001. This does not a happy developer make. Still, might have to come up with a fallback option for people using primitive devices, we will see.

Working with 2D graphics, such as with Raphael, usually involves some trigonometry and today was no exception. I really suck at trig so this was the main stumbling block. It really was very simple stuff - finding the coordinates of a point on a circle - but I’ve forgotten it all from school. I pushed through all that, scribbled furiously on paper until I convinced myself I knew what I was doing and by the end of the day I had shapes arranging themselves at my command - and even rotating them all slightly for every item in the list. Essentially I love it when things work, maybe not the first time, but before I get a headache - that’s the happiness benchmark for me.

The secret underlying all this, and all that I haven’t said, is there is no secret to developer happiness. If I’m anything to go by, we thrive on autonomy, creativity and problem solving. It is very strange that so many employers are averse to providing any form of autonomy to their developers because that has to put a damper on anyone’s aspirations. At Digital Science we are generally encouraged to come up with ideas all the time and execute them. But one of the best aspects for me is how we’re all able to hack on the infrastructure. See something that could be better? Fix it. If I couldn’t mix working on UI stuff, web backends, databases, deployment (Chef) and frivolous fun then this wouldn’t be nearly as worthwhile.

Happy hacking.