For some reason, I seem to learn better from books — actual, printed books — than I do from other forms of documentation. You’d think that programming of all things would be best learned at a keyboard, web tutorial in one window and shell in the next, but somehow when I need to absorb a big chunk of information in one go, books work better for me. I suppose they are more isolating, and encourage more concentration.
Anyway, books have been very important in my development as a programmer, and I want to talk on this blog about some of those important books. As I write this, I have eight books in mind, though I may well think of others as I gradually make my way through these.
Most of the books on my list are quite old (one of them from 1974, which I think is the oldest). That’s not accidental — I think that, even in as fast-moving a discipline as programming, it takes time for a book to establish itself as a classic; and the really good books are timeless. So there will be no Learn Head-Rush Turbo Enterprise Java Enterprise Beans For Dummies In The Enterprise In Twenty Minutes in this series. (Bonus points, by the way, for anyone who can guess what the 1974 book on my list is.)
But although I love old books, I want to start this series with the most recent book on my list (although as you’ll see the 2009 publication date is in some ways misleading, as it’s largely about programs written long ago). That’s because it’s the book I’m reading right now — I’m in the middle of the last chapter as I write this — and it’s the book that probably did more than anything else to provoke me to start this blog.
The book is Coders at Work: Reflections on the Craft of Programming, by Peter Siebel [amazon.com, amazon.co.uk]. It’s a series of lengthy, rambing interviews, averaging forty pages each, with fifteen programmers. These include some seriously big hitters: among others, Jamie Zawinsky, Peter Norvig, Guy L. Steele, my own hero Ken Thompson, and finally — saved for the last chapter — Don Knuth.
Any one of the interviews taken alone is a fascinating read; but where the book really scores is that as you read one, then another, then another, all sorts of patterns start emerging. As you’d expect, there is little in the way of unanimity — how could there be with something as personal as programming? — but there is a lot of commonality between these programmers, whose careers span from the 1950s to the present day. Some of those themes:
- With only one or two exceptions, these people seem very humble, quite unconvinced of their extraordinary ability. Someone like Ken Thompson, who invented and programmed Unix with one hand while winning the world computer chess championship with the other and inventing UTF-8 with a third hand that he kept lying around for emergencies, comes across as just happy to be hacking and all-round unimpressed by his achievements. (I once heard him give a talk on computer chess: he described one of the years in which he won the world championship simply as “a mistake”.)
- None of the programmers seemed to have any time at all for formal design methodologies like UML. While everyone recognised the value of informally whiteboarding ideas before ploughing into coding, there’s an overwhelming sense from these people that they prefer to start with only a broad design, and then refine as they code, discovering the details of the problem as they go.
- No-one likes C++. It seems to be regarded as, at best, a noble attempt to graft two incompatible worlds together. Andrew Rilstone, in his review of Ang Lee’s film Hulk, memorably described it as “The whole thing doesn’t quite work, but it’s the sort of failure one would like to see rather more of”. The impression you get of C++ from Coders at Work is that it was a success, but the sort of success one would like to see less of.
- No-one is very excited about Java, either. The general impression is of a grudging acceptance: that it does sort of get the job done, provided you don’t mind writing programs where two thirds of the code is workarounds for things the language itself doesn’t do. The only actual enthusiasm for Java came from Joshua Bloch … whose job as Chief Java Architect at Google might just have circumscribed what he felt able to say. (I will have more to say about Java in future entries.)
- Lots of the interviewees were interested in functional programming. Not in a religious thou-shalt-not-evoke-side-effects way, but as a practical tool to have in the kit. One of the effects of this has been to make me think, again, that it really is time that I got properly to grips with Lisp (or, specifically, Scheme, which everyone agrees is the purest, and therefore the most Lispish, Lisp). A few of the programmers were more rigorous about referential transparency, but they were the ones who needed it for parallelising computions.
- Most people don’t bother with debuggers (GDB and the like), preferring to debug using low-tech approaches like the insertion of printf()s. I was surprised by this, although I’d read something similar in Kernighan and Pike’s (1999) The Practice of Programming. As a matter of fact, that’s how I do most of my own debugging, but I’d always felt that it was a bit of a guilty secret and that I really should invest more effort into learning debuggers. It’s nice to know that I am at least in good company.
- Everyone spoke highly of Knuth’s The Art of Computer Programming, and plenty of people owned copies that they dipped into from time to time, but only one person had actually read it all the way through. (I don’t remember who, sorry).
- Everyone agrees that Knuth’s “literate programming” seemed like a pretty neat idea, but no-one had ever actually done it. (Er, except Knuth.)
Overall the impression was that these fifteen people — who, let the record show, have written shedloads of really important code that we all use every day — tended to be very pragmatic. Ken Thompson’s dictum “When in doubt, use brute force”, while not explicitly quoted anywhere in the book as far as I recall, seems to be a sort of unstated undercurrent. An old Internet acquaintance of mine was once on a how-to-write-a-novel mailing-list run by Tom Clancy. Apparently his contribution was “Just write the damn book”. It surprised me how often the fifteen subjects of Coders at Work seemed to be saying “Just write the damned program”. Or at least “Think hard, then just write the damned program.”
Speaking of Ken Thompson, his slightly unguarded comments about C++ and Bjarne Stroustrup make interesting reading:
Peter Siebel summarises some of his interviewees’ thoughts on C++ on his own blog. Shortish and well worth a read. Also intereasting, if you want to sample the book before committing real, live money, is this selection of quotes.
Why is the book good? (I’ll try to finish all my book-related articles by addressing this question.) Because it offers a slice through time, covering more than half a century of programming. While an amazing amount has changed in that time (plenty of the interviewees have experience with punch-cards, paper tape and toggle-switches on a front-panel), a surprising amount has also stayed the same. Seems to me that any insights into programming that are good across fifty years are carrying some real weight.