Seibel: So you don’t think there are any ideas floating around academia thathaven’t been picked up by industry simply because people resist certainkinds of change—maybe a generation of self-taught PHP programmers arenever going to warm to Haskell even if it might be a better way to writesoftware?

Norvig: I guess I’m pretty skeptical. I think that if there were realadvantages, people would be taking advantage of them. I don’t think it’s aperfect information market where everything instantly moves to the optimalsolution, but I think it approximates that. Academics may be not seeing thewhole problem that the industry has to deal with. And part of it is aneducation problem, but if you have a bunch of programmers who don’tunderstand what a monad is and haven’t taken courses in category theory,there’s a gap.

And part of it’s this legacy of we’ve got all these systems and you can’t justthrow them out all at once, so there’s a transition. I’m sure there are placeswhere industry should be more forward-looking about saying, “Sure, wecan’t make that transition today, but we should have a plan to say where arewe going to be in ten years? It’s not going to be where we are now and howdo we get there?”

But you want improvements in areas that are going to make a big impact.And I think a lot of the times the level that programming languages arelooking at is maybe too low a level to have as big an impact as languagedesigners think it’s going to. So if they say, “Oh look, in my shiny newlanguage, these six lines of code become two lines of code.” Well yeah,that’s nice, and I guess that makes you more productive and it’s easier todebug and maintain and so on. But maybe the code that you write is just asmall part of the whole production system, and really the big headache isupdating your data every day, and scraping the Web and getting this newdata in, and putting it in the right format. So you have to remember thatyou’re solving a very small part of the overall problem and that means therehas to be a big barrier to make it worthwhile to make a switch.

Seibel: So leaving aside the utility language research, you feel like we havecome a ways since computer science was like majoring in IBM.

Norvig: Yeah. I think it’s a good curriculum now, and it’s depressing thatit’s not being taken up by many students. Enrollments are down. Certainlythere is a class of people who just love computers or computer design somuch that that’s where they end up. We’re holding onto that group. Butthen there’s a bunch of the best and the brightest who are going intophysics or biology or something because those are the hottest fields. Andthen there’s a bunch who are saying, “Well, I kind of like computers butthere’s no future in it because all of the jobs are outsourced to Indiaanyway, so I’m going to do prelaw or something else so I can get a job.” AndI think that’s a shame. I think they’ve been misinformed.

Seibel: You mean it’s a shame because you think a lot of those peoplewould enjoy being programmers, or because we need them?

Norvig: Both. Many people could enjoy lots of different things and if theyenjoy two equally I don’t want to say that they have to do computerscience. But I think there is a mismatch. We need more good people and Ithink that they can have a big impact on the world and if that’s what theywant to accomplish, rationally we should be allocating more of the toppeople into computer science than we are now.

Seibel: In one of his papers Dijkstra talks about how computer science is abranch of mathematics and how computer-science students shouldn’t eventouch a computer for the first n years of their education and should insteadlearn to manipulate systems of formal symbols. How much mathematics doyou think is required to be a competent programmer?

Norvig: I don’t think you need the full Dijkstra level. And it’s a particulartype of math that he focuses on. It’s discrete, logical proofs. I guess I’mcoming from an area where that’s less important and it’s more probabilisticrather than logical. I rarely have a program that I can prove correct.

Is Google correct? Well, type in these words, you get back ten pages. If itcrashes, then it’s incorrect but if it gives you back these ten links rather thanthose ten links, there’s no saying that one is right. You can have opinions onwhich are better than the other, but you can’t go beyond that. I think that’squite different than what he had in mind. I think once you start solving thesetypes of problems or the problem of having a robot car navigate through acity without hitting anybody, the logical proof gets thrown out prettyquickly.

Seibel: So is there any essential skill needed to be a good programmer?Different domains obviously have different requirements but ultimately isthere some commonality to writing code regardless of the domain?

Norvig: You’ve got to be able to make progress and then improve on it.That’s all you need to be able to do in life. You’ve got to have some ideaand say, “Here’s the direction to go,” and then be able to say, “Now I’ve gotto refine it.” And refinement can be, “I didn’t quite get it right; there arecases I didn’t handle,” or it can be, “Now that I understand it better, I’mgoing to write a tool so that it’s more abstract and next time I can write asystem like this more easily.” Which I guess is that level of introspection tosay, “Where was I going? How did I get there? Is there a better way to getthere?”

Seibel: So do you think that that skill—essentially make it; debug it;iterate—is a kind of thinking that lots of people should learn, even peoplewho aren’t going to ultimately be programmers? If you were making agrade-school or junior-high or high-school curriculum, would you wanteveryone to be exposed to the idea of programming? Or is it toospecialized a skill?

Norvig: I think it’s specialized. I think it’s one example of this type ofthinking. But I’d be just as happy if you brought other examples like sometype of mechanical problem. “Here’s a bunch of pieces. How can I movesome water from here to here and get it into this cup?” It doesn’t have tobe manipulating lines of code. It could be manipulating many kinds of piecesand seeing how they work together.

Seibel: And how far down should programmers go? In “Teach YourselfProgramming in Ten Years,” you talk about knowing how long it takes toexecute an instruction vs. reading from disk and so on. Do we still need tolearn assembly?

Norvig: I don’t know. Knuth said, do everything in assembly, because it’sjust too inefficient to write in C. I don’t agree with that. I think you want toknow enough to know what instructions are inefficient, but that’s no longerat the level of individual instructions. It’s not just that this was a threeinstructionsequence rather than a two-instruction sequence. It’s, did youhave a page fault or a cache miss? I don’t think we need to know assemblylanguage. You need architecture. You should understand what assemblylanguage is, and you should understand that there’s a memory hierarchy andmissing from one level of the hierarchy to the next is a big performancepenalty. But I think you can understand that at the abstract level.

Seibel: Are there any books that you think all programmers should read?

Norvig: I think there are a lot of choices. I don’t think there’s only onepath. You’ve got to read some algorithm book. You can’t just pick thesethings out and paste them together. It could be Knuth, or it could be theCormen, Leiserson, and Rivest. And there are others. Sally Goldman’s herenow. She has a new book out that’s a more practical take on algorithms. Ithink that’s pretty interesting. So you need one of those. You needsomething on the ideas of abstraction. I like Abelson and Sussman. Thereare others.


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