Sunday, November 1, 2009

Coders at Work: Jamie Zawinski

Like lots of people, I'm currently spending my free minutes chewing through Coders At Work.

I find that I have different reactions to each of the programmers whose interviews I've read. I agree with many of the things that each one has to say, but (so far at least) I also find things that I disagree with. Regardless, each interview has been fascinating: well-conducted, well-related. I don't know if I'll have the energy and interest to comment on each chapter; we'll have to see as I progress through the book.

The first interview is with Jamie Zawinski. I was somewhat familiar with Zawinski's work; in particular, I'm fond of repeating his great off-handed observation about regular expressions: "now you have two problems."

I strongly agree with Zawinski about the virtues of making releases and shipping product. I feel his pain when he says:

They were much more interested in abstract things than solving problems. I wanted to be doing something that I could point to and say, "Look, I made this neat thing."
In a lot of ways the code wasn't very good because it was done very fast. But it got the job done. We shipped -- that was the bottom line.
A month later two million people were running software I'd written. It was unbelievable.
I've never had anywhere close to that many people running my software, but I know the thrill, and it's very real.

I also agree with Zawinski about the similarity between programming and writing, and about how well-written software reads like well-written prose:

I've always seen much more in common with writing prose than math. It feels like you're writing a story and you're trying to express a concept to a very dumb person -- the computer -- who has a limited vocabulary. You've got this concept you want to express and limited tools to express it with. What words do you use and what does your introductory and summary statement look like?
You can have a piece of text describing something that describes it correctly or it can describe it well, with some flair. And the same thing's true of programs. It can get the job done or it can also make sense, be put together well.
I remember once, fairly early in my career, I was talking with another engineer who had taken a look at some code I had written, and he said: "it's interesting when I read your code. I feel like you're there with me, like I can hear you talking, like you're speaking directly to me through the code."

I think that in many ways, programs are not written so much for the computer, but for the other humans that come along later and read them, and I think that one mark of truly great software is that it reads well.

I find that I disagree with Zawinski in his approach to the more nitty-gritty aspects of programming, such as design, testing, etc. In his defense, he was under immense time pressure, but still:

When I'm just writing the first version of the program, I tend to put everything in one file. And then I start seeing structure in that file. Like there's this block of things that are pretty similar. That's a thousand lines now, so why don't I move that into another file. And the API sort of builds up organically that way. The design process is definitely an ongoing thing; you never know what the design is until the program is done. So I prefer to get my feet wet as early as possible; get something on the screen so I can look at it sideways.
There's bound to be stuff where this would have gone faster if we'd had unit tests or smaller modules or whatever. That all sounds great in principle. Given a leisurely development pace, that's certainly the way to go. But when you're looking at, "We've got to go from zero to done in six weeks," well, I can't do that unless I cut something out. And unit tests are not critical.
It's a matter of priorities. Are you trying to write good software or are you trying to be done by next week? You can't do both.

I was never at Netscape, and I don't know what the time pressures and environment was like, but this sort of approach to programming would drive me up the wall. Of course, the bottom line is: they built one of the most interesting pieces of software yet written by humans, and so who am I to criticize? But I don't think I could have stood by and participated in such a project. I'm just too methodical and detail-oriented, and too much a believer in the value of testing.

It sounds like Jamie Zawinski is a fascinating programmer, and it would have been interesting to work with him, particularly at Netscape; just not for very long.

I was a bit disappointed that Seibel didn't coax Zawinski into talking more about the transition to open source. It must have been a very interesting experience to be part of the creation of the Mozilla Foundation, and the transfer of the Netscape software and knowledge to the open source community, but either Seibel didn't ask much about the experience or Zawinski didn't have much to say about it.

No comments:

Post a Comment