Crockford: It was at Electric Communities. We got together the smartestteam of programmers I’ve ever seen assembled anywhere. And we hadenough money and we were going to reimplement the stuff that Chip andRandy had already done and knew exactly how to do it. Except it wasgrander.

Seibel: So that was basically Habitat, redone.

Crockford: Yeah, we were going to redo Habitat except it was now goingto be globally distributed. And it turned out to be really hard. We actuallygot it built but it was painful. Not something I’d like to do again.

Seibel: Would the advice you gave before—to be very disciplined aboutonly reimplementing what you already understand—would that have beensufficient to head off the disaster?

Crockford: I think it could have helped. We didn’t think about it in stagesproperly. We didn’t have an incremental approach. Had we taken anincremental approach, I would have started with two parallel efforts. One,work out a secure distributed platform which doesn’t do anything but hasthe infrastructure for doing the messaging and the object management. Two,let’s rebuild Habitat. Knowing what we know, with modern languages, let’sjust rebuild it.

Then the second phase would be, OK let’s merge them together. Can wehoist this one on top of that one and still have a working system? OK, nowdistribute it.

Had we taken that kind of incremental approach, I think we would havebeen very successful with it. But we tried to do all of those in one step andthat was too hard.

Seibel: And you think you were led into trying to do it in one step becauseyou knew big chunks of it.

Crockford: Because we were so smart and we had so much experience.We had it wired. Couldn’t miss. Programmers are optimistic. And we haveto be because if we weren’t optimists we couldn’t do this work. Which iswhy we fall prey to things like second systems, why we can’t schedule ourprojects, why this stuff is so hard.

Seibel: Is programming getting easier? In the future will more people beable to do something that we would recognize as programming?

Crockford: My interest in programming is helping other people to doprogramming, designing a language or a programming tool specifically so thatit’s more accessible to more people—the thing that got Smalltalk started.Smalltalk went in a different direction, but the initial direction was reallyattractive to me. How do we build a language specifically for children orhow do we build a language specifically for people who don’t think ofthemselves as programmers?

Seibel: Is that because you think should everybody learn to program, atleast a little bit?

Crockford: I think you have to. The world has been pretty much takenover by computers now and in order to defend yourself, or to be a fullcitizen, you have to have some understanding of how these things work.

Seibel: Some folks would also argue that learning to program teaches a wayof thinking that’s important, like reading and math are different ways ofthinking, and both important.

Crockford: I used to think so. I had these amazing insights when I startedprogramming: everything became orderly, and I saw structures and things Ihad never seen before. I thought, “Wow, this is amazing. Everybody shouldlearn how to do this,” because suddenly I was feeling a lot smarter. Exceptpretty quickly I’d find, talking to other programmers, that somehow theydidn’t get it. Programmers are capable of completely misunderstanding theworld in exactly the same way everybody else does. I was really sad tofigure that out.

Seibel: Do you still enjoy programming as much as you always did?

Crockford: Oh, yeah.

Seibel: Do you think that programming is at all biased toward being young?

Crockford: I used to think so. A few years ago I had sleep apnea, but Ididn’t know it. I thought I was just getting tired and old, and I got to thepoint where it was so difficult to concentrate that I couldn’t programanymore because I just couldn’t keep enough stuff in my head. A lot ofprogramming is you keep stuff in your head until you can get it writtendown and structured properly. And I just couldn’t do it.

I had lost that ability and I thought it was just because I was getting older.Fortunately, I got better and it came back and so I’m programming again. I’mdoing it well and maybe a little bit better now because I’ve learned how notto depend so much on my memory. I’m better at documenting my codenow than I used to be because I’m less confident that I’ll remember nextweek why I did this. In fact, sometimes I’ll be going through my stuff and I’mamazed at stuff that I had written: I don’t remember having done it and it’seither really either awful or brilliant. I had no idea I was capable of that.

Seibel: I read somewhere where you said that literate programming, a laDonald Knuth, is a brilliant idea. Do you use literate tools?

Crockford: No. I’ve been thinking about it and I’ve been designing literatetools for some of the languages that I’m using but I’m currently not doingany literate programming.

Seibel: Is that just a tool-chain problem? If the tools existed you think youwould write literate programs?

Crockford: I would. I think JSLint, for example, would be easier for me tomaintain if I had written it in a literate style. The thing I like about theliterate style is that you’re designing the program specifically for reading andI think that provides tremendous value to the program.

Seibel: What are the key features of a literate programming tool, as yousee it?

Crockford: The principal thing that Knuth found or provided was theability to write out of order. So if I’m concerned with a particular thingwhich touches code in a lot of places, I can collect all that code togetherand describe it together, and then the tool will distribute the details out towhere it needs to go.

Another of the things he frees you from is the size of a function. Ideally, youwant a function to be no bigger than a screen’s worth so that you can readit all at once. And if it doesn’t fit, then you’re making a lot more functions,and if the functions aren’t actually contributing anything to the structure ofthe program, they’re just introducing noise.

Knuth allows you to take each of the aspects of that function, which may beclosely related—it might have good coherence but it’s just big; sometimesstuff is big—and he allows you to represent each of those collections of stuffwith an extremely descriptive label and then say, “This function is:” and thenlist those labels. You could do that with functions, but it’s not quite thesame and then you have to deal with communication between the pieces,and so on. So it’s introducing more structure which doesn’t exactly matchthe problem.

Ultimately I would like to see new languages designed specifically to beliterate languages. Knuth has been very good at applying the idea to Pascaland C, but I’d really like to see a new language which is, from the bottom,designed to be used in that fashion.

Seibel: Have you read Knuth’s literate programs?

Crockford: Sure.

Seibel: How do you read them? Like a novel?

Crockford: Yeah, I read it like a novel. I tend to be reading his proserather than his program, but I really like the way he lays it out and he writesreally well, and occasionally he’ll slip a little joke in there. I enjoy reading hisstuff.

Seibel: And what do you get out of it? So you’ve read TeX: The Program,and you get to the end. Now are you ready to go add features into TeX ordo you just have an overall sense of wow, Knuth’s a brilliant guy?

Crockford: That’s a really good question. I’ve read TeX, but I didn’t read itwith an intention that I wanted to modify TeX. I was just reading it to seewhat he had done. I had a particular interest in how he was doing linebreaking,so I read that part with particular interest, more to understand hisalgorithm than to understand how the code works so that I can modify it orreuse it. If I were reading it with the expectation that I was going to messwith the program, I’m sure I would’ve read it differently.


Перейти на страницу:
Изменить размер шрифта: