Jamie Zawinski
28
that is either start at the top or at the bottom. So start with either,
put a window on the screen that has some buttons on it, and then dig
down and start building the stuff that those buttons do. Or you can
start at the other side and start writing the thing that parses mailboxes
and that saves mailboxes. Either way. or both and meet in the middle.
I find that getting something on the screen as soon as possible really
helps focus the problem for me. It helps me decide what to work on
next. Because if you’re just looking at that big to-do list it’s like, eh, I
don’t know which one I should do—does it matter which one I do?
But if there’s something you can actually look at, even if it’s just the
debug output of your mailbox parser, it’s like, OK, there! That’s
something; what’s the next direction this needs to go in? OK, instead
of just displaying a tree structure, now maybe I should be emitting
HTML or something along those lines. Or parsing the headers in a
more detailed way. You just look for the next thing to build on from
there.
Seibel: Do you refactor to keep the internal structure of the code
coherent? Or do you just have a very good sense at the beginning how
it’s all going to fit together?
Zawinski: I usually have a pretty good sense of that. I don’t
remember too many occasions where I thought, “Oh, I did this whole
thing inside out. I’m going to have to move everything around.” That
does happen sometimes.
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.
Also, once you start writing the code, you’re gonna realize, “No, that
was a dumb idea. Why did I think that this module was going to be
really easy when actually it’s way more complicated than I thought?”