read


read
or learn more

(take 8 (phil-hagelberg))

Jun 28, 2010

technomancy

Continuing my series of micro-interviews with Clojure hackers I present Technomancy (aka Phil Hagelberg). Phil continues the theme of prolific coders having brought us a series of fantastic projects. Most notable among his Clojure output is the (increasingly ubiquitous) Leiningen build tool. However, the story of his mad output does not end there as the Emacs Starter Kit, clojure-http-client, and my personal favorite Robert Hooke attest. Additionally, he is maintaining both clojure-mode.el and Swank/Slime for Clojure. As if that were not enough, Phil is also a contributor to the Duby programming language and to Clojure itself — and all of this1 is without mentioning his Ruby contributions! Finally, Phil works for Sonian, which is the Avengers2 of the Clojure community.

Q: What led you to Clojure?

I started programming with QBasic in 7th grade, and I got into writing Zork-style text adventures. Of course I didn’t understand data structures, so my games were very much copy/paste affairs. I wanted to put together a tool that could create text adventures, but I ended up trying to do this by outputting the whole source (with hard-coded rooms, gotos, etc) to .BAS files on disk instead of separating out data and logic. As you can imagine it didn’t work very well, but it got me thinking.

In college I realized I’d have to make the choice at some point between Emacs and vi. I gave them each a brief shot, but the default vi key bindings are designed to work with a QWERTY layout and are nonsense on Dvorak, (yes, I realize now you can fix this) so I ended up going with Emacs. Once I got going with Elisp I realized it had the magic “programs writing programs” property that I’d been looking for since 7th grade, and that sealed the deal for me.

Of course, you can’t do that much with Elisp, at least if you want to get paid, so I toyed around with Common Lisp. My background was in web programming at that point, and so naturally I thought, “I know, I’ll port my blog to it!” That lasted about a month—it was so awkward at the time just to find a decent HTTP server, so CL still has this aura of the 1980s associated with it in my head, complete with big hair and Tears For Fears playing in the background. (Having VAX filesystem support included in the language spec certainly doesn’t help with that image.)

I got into Ruby in 2005 since it felt “close enough to lisp” to keep my interest, and the money was certainly good. But when I watched Rich’s Clojure for Lisp Programmers videos one weekend in November of 2008 it became clear that you could really use it for everyday tasks. So the pragmatic angle really pulled me in, though the immutability was what caught my eye to begin with.

Keyboard Pants

Q: Are you planning on starting a line of keyboard pants? (please say yes)

I’ll probably sell a kit, Altair-style and let hackers put them together themselves. I wouldn’t want to deprive them of the hands-on fun of assembly. I think they’re great, but I fully acknowledge that I’m on the lunatic fringe of input and interface mechanisms.

Q: As someone who seems to manage an astonishing number of projects simultaneously, how do you manage to avoid starving any given project?

At first I misread this as “how do you manage to avoid starting any given project”. My answer for that is more interesting, so I’ll start there.

Orestes

It used to be that I was limited by coming up with names; naming projects is really hard. But these days I’ve decided on a policy of naming all my projects after literary characters, which has led me to the opposite problem—I need to make sure my projects are good enough for the names I’ve got in mind. I’ve got this silly 25-line test coverage hack that I want to release, but calling it “Orestes” seems like it doesn’t do Æschylus’s work justice. So I’m limited by the rate at which I read new fiction—I need to stumble across some minor characters with names that do a better job at reflecting my humbler hacks.

As for avoiding starving any given project—well, just ask anyone who’s sent me patches: I simply don’t. It’s disgraceful. I really try to focus on one project at a time, but that means patches can wait for three months before getting applied if they’re for a project I’m not focusing on.

I try to improve this situation by giving more people commit access so I don’t become a bottleneck, but this is tricky. I guess people don’t feel like they’re qualified, which is totally bogus. I’m certainly not “qualified” to maintain Swank Clojure. I got into it because of my background in Emacs, but it turns out you really need to understand its Common Lisp background. I have only a superficial understanding of the codebase.

I like to think of myself more as the “steward” of that code rather than the “maintainer”. But I get the patches applied, fix a few bugs, and get the releases pushed out. It’s something you can ease your way into, so I encourage readers to help out with projects they’re interested in. Don’t be intimidated.

Q: What is your relationship to Bus Scheme?

Bus Scheme logos

Well, I used to work in downtown Seattle, so I spent a lot of time on the bus. I got a copy of The Little Schemer and wanted to play around with the ideas in it, so I started Bus Scheme (in Ruby) with the stipulation that all implementation must happen while riding the bus. I had a lot of fun with that. It never got continuations or hygienic macros, but I had the basics of the interpreter working fine and put together a simple CL-style macro system.

I recommend it as an exercise to folks interested in the nuts and bolts of language implementation. It’s much less work than it sounds for a language as small as Scheme, and to people who haven’t done their own implementation (potential employers perhaps?) it sounds really impressive. I certainly learned a lot about parsing and lexical scope as well.

One of these days I’ll move on to Unicycle Java, but I’ve got enough on my plate right now.

Q: What’s your favorite code snippet? (any language)

I really like Camping because it showcases the playful spirit of Hackerdom. I think that spirit is one of the most important things I picked up while doing Ruby. If you can’t have a little fun with your code and put your best practices away for a quick hack then is your heart really in it? I think even in more serious projects there’s room for easter eggs if they don’t get in the way.

$ apt-get moo

         (__) 
         (oo) 
   /------\/ 
  / |    ||   
 *  /\---/\ 
    ~~   ~~   
...."Have you mooed today?"...

In Clojure I’d have to say I like the implementation of fixtures in clojure.test:

(defn compose-fixtures
  "Composes two fixture functions, creating 
   a new fixture function that combines their 
   behavior."
  {:added "1.1"}
  [f1 f2]
  (fn [g] (f1 (fn [] (f2 g)))))

(defn join-fixtures
  "Composes a collection of fixtures, in order.  
   Always returns a valid fixture function, even if 
   the collection is empty."
  {:added "1.1"}
  [fixtures]
  (reduce compose-fixtures default-fixture fixtures))

There’s not a lot to it, but this lets you compose a chain of fixture functions that gives you an immense level of flexibility over what goes on in your tests. This is one of my favourite hacks in that it succinctly demonstrates the power of “everything is a function”. I used this as the basis for Robert Hooke, a more generalized plugin mechanism.

Q: What is your favorite fiction book?

Gabriel Syme

Well, Dante’s Comedy is almost certainly the best fiction Christendom has produced, but I don’t read Italian, so I’m going to go with G.K. Chesterton’s The Man who was Thursday. Everything I’ve read of Chesterton’s is brilliant, but Thursday stands out for its portrayal of courage as well as the way it addresses the Problem of Evil.

Some books reward repeat readings with new insights into corners of the story that you may have missed the first time around. Thursday takes it to a whole new level—the first four times I read it I came away thinking the whole point of the book was something I hadn’t seen before. It’s mind-boggling that a novel can be so light on the one hand as an adventure story yet still contain so much philosophical depth.

I’ll consider my programming career to be a success if I ever work on a project that’s good enough to merit being named after Gabriel Syme, aka Thursday, the book’s poet-detective protagonist.

The book in the public domain and is not very long, so give it a read.

I’m currently in the middle of Steven Levy’s Hackers, which is probably my favourite non-fiction book right now. It’s exciting to read about the level of energy and awe in the early days of computing. Seeing what people had to go through to get access to even the most primitive of machines gives you a great sense of perspective and helps you appreciate what we have today.

Q: Can you provide a picture summarizing your view on working for Sonian?

Sure. We have a distributed team that communicates through the Internet, so it’s basically like this:

sharing your codes to the git hubs?

Distributed work involves some really weighty trade-offs. On the one hand you can hire from anywhere in the US, which is absolutely fantastic. It has allowed us to get an excellent team together; you couldn’t get this concentration of talent in any one city. But on the other hand you’re missing something by not being able to see co-workers face-to-face.

We work around this by relying heavily on VoIP and tmux (a more modern implementation of the ideas in GNU Screen) while pairing and also by having quarterly in-person “summit” meetings where we all live out of the same house for a week and participate in intensive hack sprints. It’s definitely a net win, but it has its challenges.

Q: What does a typical work day look like?

The Lab

I get up at 6:30 with my kids (9 months and 2½ years) and play for a while. At 9:00 I head out to the Code Lab, a converted shed in the back yard for our daily VoIP standup. I described my setup there in a recent blog post; it involves a standing desk, a Thinkpad, and a recliner. Being at home means I get to take lunch with my family, which is great even though the food selection isn’t quite what it was in downtown Seattle. Lately the weather’s been warming up, so sometimes I’ll work from the back porch or a nearby coffee shop. Every so often I’ll head out to a nearby park just to get a change of scenery.


  1. Am I the only one who feels like a slacker? 

  2. Where Clojure/core would be the Super Friends. 

2 Comments, Comment or Ping

  1. I finally decided on a name for the coverage tool; it will be dubbed “radagast”: because it’s something that sounds a lot cooler than it actually turns out to be and shouldn’t be relied upon for anything important.

    In the words of Sauruman: “Radagast the Brown! … Radagast the Bird-tamer! Radagast the Simple! Radagast the Fool! Yet he had just the wit to play the part that I set him.”

  2. Roy

    I like the image-based breakdown to using git & github!

Reply to “(take 8 (phil-hagelberg))”