美文网首页
高德纳(Donald Knuth)语录

高德纳(Donald Knuth)语录

作者: 光剑书架上的书 | 来源:发表于2021-04-09 02:10 被阅读0次
    1. Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.

    受过良好训练的计算机科学家知道如何处理算法:如何构造算法、操作算法、理解算法以及分析算法。这些远不只是为了编写良好的计算机程序而准备的。算法是一种一般性的智能工具,一定有助于我们对其他学科的理解,不管是化学、语言学、音乐,还是另外的学科。为什么算法会有这种作用呢?我们可以这样理解:人们常说,一个人只有把知识教给别人,才能真正掌握它。实际上一个人只有把知识教给“计算机”,才能“真正”掌握它,也就是说,将知识表述成一种算法......比起简单地按照常规去理解事物,用算法将其形式化会使我们获得更加深刻的理解。

    1. Programming is a very personal activity, so I can't be certain that what has worked for me will work for everybody. But as time went on, I’ve become extremely pleased with the name, because I think that a complex piece of software is, indeed, best regarded as a web that has been delicately pieced together from simple materials.

    3、When I first began to work with the ideas that even-tually became the WEB system, I thought that I would be designing a language for “top-down” programming,where a top-level description is given first and successively refined. On the other hand I knew that I often created major parts of programs in a “bottom-up” fashion, starting with the definitions of basic procedures and data structures and gradually building more and more powerful subroutines. I had the feeling that top-down and bottom-up were opposing methodologies: one more suitable for program exposition and the other.

    Top-down programming gives you a strong idea of where you are going, but it forces you to keep a lot of plans in your head; suspense builds up because nothing is really nailed down until the end. Bottom-up programming has the advantage that you continually wield a more and more powerful pencil, as more and more subroutines have been constructed; but it forces you to postpone the overall program organization until the last minute, so you might flounder aimlessly more suitable for program creation.

    --关于自顶向下,还是自底向上,其实结论就是按意识流走

    4、And the fact that there’s no need to be hung up on the question of top-down versus bottom-
    up—since a programmer can now view a large program as a web, to be explored in a psychologically correct
    order—is perhaps the greatest lesson I have learned from my recent experiences.

    5、One of the main characteristics of WEB is that different parts of the program are usually abbreviated, by giving them such an informal top-level description.

    6、I have come to realize that there is no need to choose once and for all between top-down and bottom-up, because a program is best thought of as a web instead of a tree. A hierarchical structure is present, but the most important thing about a program is its structural relationships. A complex piece of software consists of simple parts and simple relations between those parts; the programmer’s task is to state those parts and those relationships, in whatever order is best for human comprehension— not in some rigidly determined order like top-down or bottom-up.

    -- 程序是 simple parts and relations between parts

    5、I owe a great debt to Edsger Dijkstra, Tony Hoare, Ole-Johan Dahl, and Niklaus Wirth for opening my eyes to the importance of abstraction in the reading and writing of programs, and to Peter Naur for stressing the importance of a balance between formal and informal methods.

    6、Knuth: I learned a terrific amount while I was doing it. One of the things I learned was how much software occupies the brain. It was a much more difficult task than I expected. I couldn’t teach classes full-time and write software full-time. I could teach classes full-time and write a book full-time but software required so much attention to detail. It filled that much of my brain to the exclusion of other stuff. So it gave me a special admiration for people who do large software projects—I would never have guessed it without having been faced with that myself.

    7、The first rule of writing is to understand your audience—the better you know your reader the better you can write, of course. The second rule, for technical writing, is say everything twice in complementary ways so that the person who’s reading it has a chance to put the ideas into his or her brain in ways that reinforce each other.

    8、So literate programming is based on this idea that the best way to communicate is to say things both informally and formally that are related. And it just provides a natural framework for switching between the natural language, English, and the formal language, C or Lisp or whatever is your formal language, and putting this together. So that, to me, has to be a win for documentation.

    --编程过程中需要自然语言和程序语言交相辉映

    9、Now, the other thing is, as I write the program, I don’t have to present it in the form that the compiler wants to see it. I present it in the form that I think is easiest for a reader to understand.

    10、And almost always the way my final program comes out is in the order in which I actually thought of the things myself. So I’ll start out and I’ll say, “I have this problem to solve, so first I’m going to have to solve this and then I’m going to have to solve that.”

    But then I say, “Now let’s start building some tools bottom-up.” We have the goal in mind but we build a few bottom-up tools and then we’ll go back and do a little top-down. But in what order we do this is, first I write about what I thought about the first day I had to work on this problem. And then, the next chapter would be the thing I decided to tackle next. And I start to tackle the thing that’s most worrying to me but that I’m also ready to solve at the moment. Instead of postponing something ’til an evil day, if I’m ready to do it now, I get that out of the way. But it’s a different order—it’s neither top-down nor bottom-up. It’s psychologically, “What do I find is the thing that’s going to make me most satisfied to get done next and I’m ready to do it?” It doesn’t have too many unknowns in it.So the freedom to put the program into that human-understandable order is very important to me.

    --- 编程的心理活动

    11、Knuth: Exactly. This is what literate programming is so great for, I can talk to myself. I can read my program a year later and know exactly what I was thinking.

    --- 大师都喜欢同自己对话

    12、Yet I can’t help but think that it’s considerably below what can be achieved with literate programming. Because of lots of intangible things that I can’t prove.

    The most convincing to me was that I believe that I’ve written some programs that I could not have written at all without literate programming. For example, the MMIX simulator would have been such an intellectual challenge that if I had to do it in the conventional style, I don’t think I ever would have finished it. Just separating it out into subroutines wasn’t enough to simplify it to make it intellectually manageable.

    -- 大师都说单纯的将其分成子程序也不是智力所及的,说明通过这种方法可悟出解决复杂问题的道理

    13、Knuth: This is true. Instead of calling a subroutine, it’s like inline subroutines all the way through. The idea of a subroutine is there but it’s not in your final program as a subroutine. It’s more like a macro in some ways. But the thing is, at the conceptual level, the subroutine-calling mechanism isn’t necessary if you have some other way to do it in the language you’re using.

    14、Of course, eventually it has to go into a computer, which is rigid, which has its precise rules of understanding. But to me the idea of the right kind of a program is something that matches the way I think as closely as possible rather than something that matches the machine as closely as possible. I have to find the way to do the conversion, but my source text tries to stay closer to my brain than to the machine.

    --- 在问题和程序中间添加了一层东西,就是贴近大脑的表达

    相关文章

      网友评论

          本文标题:高德纳(Donald Knuth)语录

          本文链接:https://www.haomeiwen.com/subject/inwbkltx.html