Sorry this page looks weird. It was automatically migrated from my old blog, which had a different layout and different CSS.

Realising Enthusiasm

The result is that programmers often wind up using syntactically efficient languages like Perl, Python, and Ruby to write little throwaway programs that they might never have written in the first place using, say, C, because it’s so much less of a hassle to get a simple working program off the ground. There’s simply less friction between the idea to write a little program and actually doing it.

John Gruber


A few years ago on a windsurfing trip in the Sinai I got into sudoku between sessions on the water. After a couple of weeks of solving them by hand I had derived four rules which seemed to handle every situation without guesswork. On the plane home I figured I could become rich by writing a little program to poll, say, 200 newspapers' websites, download each one’s daily puzzle as soon as it became available, solve it and email the solution back to them, all in the blink of an eye. If I regularly won the £5 (or whatever) prize for the first solution from, say, 95% of them, surely with the winnings I could stop writing business software and just go windsurfing instead?


So I sat down to code up my four rules in Java, my primary language then. And what should have been a quick job took forever: instead of just writing out the logic I wanted, I had to spend ages converting the numbers on the board back and forth from one datatype to another as I ran them through my logic; typing umpteen useless brackets and semi-colons to please the compiler; and writing out all the extra boilerplate which Java requires before you get to the half-dozen lines which are the actual point of your program. In the end my enthusiasm waned before I finished pleasing the compiler.


Later on when I encountered Ruby, I thought I’d try writing my sudoku solver again to see whether it was any less painful.

It was a revelation.

Instead of spending hours typing language formalities which had nothing to do with the problem I wanted to solve, I just typed out what I wanted to say. It took less than half an hour, and most of that time was spent trying to work out what I was missing because it couldn’t be so easy. By then it felt a bit mean to clean up the newspapers' puzzles — I couldn’t bear to take away any scrap of hope commuters might be clinging onto to get them through the daily grind. (I work at home.)

Delivering my enthusiasms

Anyway, to echo Gruber, the thing I love about Ruby is it keeps up with my enthusiasms. I often find inspiration in random places and get seized by enthusiasm for something for an hour or two. Then my excitement wanes, I have to do something else, I move on. I always found Java disappointing because whenever I got fired up about something inherently programmable and started coding away for the fun of it, I would find myself sapped by the overhead the language forces on you, get increasingly bogged down and after a while realise I no longer cared enough to finish.

With Ruby I just express the problem and express my solution, and that’s it. I can crank out these little programs with minimal fuss while my enthusiasm remains high — it’s so motivating. Of course they’re all pointless but that’s due to my eclectic taste, not Ruby.

More is much more

The directness with which I can express my ideas in Ruby, which allows me to write interesting little programs, lets me write interesting big programs too. In fact the benefits accrue as my software gears up in size and complexity. I can’t quantify this easily but I strongly believe this accrual increases geometrically rather than linearly: a problem domain which is twice as complex will be more than twice as tractable in a dynamic, productive language like Ruby than in a cautious, defensive language like Java. And that leaves more time for windsurfing.

Andrew Stewart • 23 February 2009 • ProductivityRuby
You can reach me by email or on Twitter.