January 2010 Archives
I love to listen to great developers talk about how they write software. If you like the same thing, then you should check out Coders at Work by Peter Seibel. Peter rounded up some amazing folks from the software development world to interview, like Jamie Zawinski, Guy Steele, Ken Thompson, Peter Norvig, and the ultimate shot caller himself, Donald Knuth.
I continue to find must-read passages in this book, like this selection from Peter's interview with Guy Steele. Guy Steele, of course, did hugely important work on Emacs, Scheme, Java, and Common Lisp. I love how he correlates the edge cases of fairy tales and software.
Guy Steele: And I think that the other problem is that people like to focus on the main thing they have in mind and not worry about the edge cases or the screw cases or things that are unlikely to happen. And yet it is precisely in those cases where people are most likely to disagree what the right thing to do is.
Sometimes I'll quiz a student, "What should happen in this case?" "Well, obviously it should do this." And immediately someone else will jump in and say, "No, no, it should do that." And those are exactly the things that you need to nail down in a programming specification of some process.
I think it's not an accident that we often use the imagery of magic to describe programming. We speak of computing wizards and we think of things happening by magic or automagically. And I think that's because being able to get a machine to do what you want is the closest thing we've got in technology to adolescent wish-fulfillment.
And if you look at the fairy tales, people want to be able to just think their minds what they want, waive their hands, and it happens. And of course the fairy tales are full of cautionary tales where you forgot to cover the edge case and then something bad happens.
Peter Seibel: Fantasia and the perils of recursion, of course.
GS: Fantasia and recursion, yes. Or, "I wish I was the richest man in the country" - well, that makes everybody else extremely poor and you're the same as you were before. That kind of thing happens in fairy tales because people forget that there's more than one way to do something. And if you just think about your main wish and don't think about the details, that leaves a lot not tied down.
PS: So the lesson from fairy tales is that the Gandalfs of the world got there by hard labor, learning the incantations, and there's no shortcut to that?
I've never seen anyone make an analogy between these two bodies of work before, but we often do find ourselves creating software as if we were in the a fairy tale, paying little attention to what could go wrong. The entire book is loaded with great, insightful stuff like this. I encourage everyone to check it out.