Current location - Quotes Website - Signature design - How to read and learn the art of computer programming (TAOCP)?
How to read and learn the art of computer programming (TAOCP)?
Oh, my God! The Art of Computer Programming quoted the famous Wang Yin's comment on TAOCP: I have long wanted to write a comment on Knut's The Art of Computer Programming. I didn't expect to find a similar TAOCP about Knut as soon as I went to Amazon. I think most people claim to have read his books or bought them, but that's just as a show-off capital or decoration. The students across the hall bought a set of three brand-new hardcover books a few years ago and spent more than 200 yuan. However, he has never read it. I borrowed a few pages and put them there. How can I have time to watch him implement simple linked lists in those machine languages with 6 bits in one byte! One day, a younger brother came in and saw the set of books on my bookshelf, showing awe: "Dig! Brother! You are great! I actually read such a profound book! " I am stupefied. Yeah, not bad. This set of books on the shelf will impress me. I'm afraid this is its practical effect on many people. There are others who can help deify this book and deify themselves at the same time. For example, he can say, "I will hire anyone who has finished reading Don Knut's The Art of Computer Programming!" So you can look taller than the average person who has read a book. It is said that Bill Gates did just that. I doubt whether he has read it himself. One of the reasons why I hate this set of books is that Knuth deliberately wrote this book in a machine language called MIX. Although he designed a new processor MMIX in the new edition, he changed the medicine. He believes that an "eternal" computer programming book should not use high-level languages, because they are easily outdated. But he was wrong. Machine language is the most easily outdated thing. Just look at how many brands of updated processors there are now. Moreover, there are indeed very advanced languages in the world, which have not been out of date since the 1960s. I predict that MMIX will be eliminated in the near future. Interestingly, MMIX added an "M" to MIX, which stands for Millennium. The monograph on it is also named mmix ware- RISC computer in the third millennium. A thousand years or even a short hundred years, decades later, it is not clear whether the computer is a binary integrated circuit. In addition, this processor actually took something from RISC II, Sparc and other processors, and there was no big innovation. He printed the simulation program of this processor on paper and sold it, saying, "An excellent program should be as easy to read as a good novel. A good programmer will win a Pulitzer Prize in the future. " It is ok to write a little basic computer introduction in machine language, but writing a whole book is easy for readers to see the trees but not the forest. One of the most common phenomena when watching TAOCP is, "Wow! It turns out that this program can be written like this. " But you don't know why you wrote this. Although we can know some potential reasons, readers will never understand the most basic principles. This is like seeing every pixel of a picture clearly, but not recognizing that this picture is actually an acquaintance. See clearly where each piece on the board can go, but you can't win. Dijestra said that computing science should not be called "computer science", just as surgery should not be called "knife science". But what does this have to do with Knuth? His title is art ... let's talk about his checks ... many people regard Knuth's checks as something to show off. I saw a photo of a professor in Cambridge before, and there was a Knuth check on the homepage. Can Knut's check really be used as a show-off capital? I tell you, all the mistakes I found were typos, but I didn't expect him to check them for me. Who told him to type carelessly, and he could type for a thousand years? Hey! I received a check for a meal, and I want to cash it at the Bank of China, ready to change the money into a big meal. But the bank staff told me that they had to send the check back to the United States to get the cash, and the cost of handling this matter was far higher than the value of the check itself! So Knuth gave me some bad checks. Damn it. I should have thought of it a long time ago. Why didn't he transfer the money to everyone's credit card? Instead, he used a check, an outdated thing! He obviously felt that no one would cash a check with his signature, or even frame it as a souvenir. Hmm ... you are cruel ~ ok, let's go. Or look at this book review written by others. White elephant, this really tells me how I feel about this set of books. But I can't agree with some opinions of the evaluator, such as "O(n) mark is enough". ) I hope to have such a public comment on paper in the future! The Story of Dan Friedman (4)-C3 1 1 When I first transferred from Cornell to IU, Dan Friedman asked me to take his postgraduate project language course B52 1. I don't want to take Cornell's class, because I have taken a program language class. Friedman called me to his office, sat me next to him and said kindly, "Wang Yin, I know you took this course at Cornell. I also know Cornell is a much better school than IU. But each teacher's teaching method is different. You should come to my class. My friends and I are professors here, not because we like this school, but because our family and friends are here. " Later, due to the overlap with Amr Sabry's course B522, he specially arranged for me to take C3 1 1 for the undergraduate course, but I got credit for the postgraduate course. Later, it was found that there was basically no difference in the contents of these two courses, except that graduate students had more homework. In the first class, he said a sentence that I still remember: "The schemer and essence of programming language are the reference materials of this course, but I never talk about the content of my book in class." At first, I found that this course was very different from what I studied at Cornell. Although I learned some concepts in his class, such as closure and CPS, I saw a completely different side of these concepts, so that I felt I didn't understand them at all! This is because when I studied these things at Cornell, I only used them to cope with my homework, while in Friedman's class, I used them to accomplish practical goals, so I really realized the connotation and value of these concepts. An example is that a few weeks after the course started, we started to write an interpreter to execute a simple Scheme program. Then we use CPS to transform this interpreter, introduce global variables as "registers", and convert the continuation generated by CPS into data structures (that is, stacks). Finally, an abstract machine is obtained, which is essentially equivalent to the central processing unit (CPU) or virtual machine (such as JVM) in a real machine. So we actually invented the CPU from scratch! From here, I really understand the nature of registers, stacks and so on, and why we need them. I really understand why the Von Neumann architecture is designed this way. Later, he let us read a paper by his good friend Olivier Danvy about how to get different kinds of abstract machine models from different interpreters through CPS transformation. This is the first time that I feel the great power of the theory of programming language to the real world, and it also makes me understand that machines are not the essence of computing. Machines can be realized by any feasible technology, such as integrated circuits, lasers, quantum, molecules, genes ... but no matter what materials are used as machines, the semantics we want to express, that is, the essence of computing, remain unchanged. And these are not all my C3 1 1. In the second half of the semester, we began to learn miniKanren, a logic programming language he designed for teaching. This language is similar to Prolog, but it eliminates many shortcomings of Prolog and becomes easier to understand. The textbook is "Rational Conspiracy" given to us free of charge. At the end of the book, two pages is the realization of the whole miniKanren language! I learned quickly, and then I started to fix this implementation, redesigned some parts, and then added some functions I wanted. This kind of teaching has given me the ability to design logical languages, not just a user. This is impossible to learn Prolog, because the complexity of Prolog implementation will make beginners unable to start and can only stay in the user stage. I was lucky enough to listen to him and take this course, otherwise I wouldn't be who I am today. Knuth, a real programming language expert, once said something similar: "If you don't understand TAOCP, don't be a programmer." He has always been called "the God of Computer Science". In his speech, he talked about literature, art, God and religion, giving people a sudden sense of mystery. He has always said that programmers should learn machine language, not high-level language, and machines are the unchangeable truth. But Knuth doesn't look at this problem from a scientific point of view, but only his personal prejudice. When he saw that the development of Fortran, LISP, ALGOL, Pascal, C, c++ and Java seemed endless, he did not understand the principle of invariance. He is not a strong man in programming language design. He probably didn't understand lambda calculus and type theory at all, otherwise he wouldn't have designed a messy language like TeX. The quality of TeX typesetting is understandable, but by 1978, he is still using the dynamic range that has been hated by programming language experts and some other poor designs, which shows that he lacks understanding of programming language theory. In fact, TeX contains a fully extended Turing language, because Knuth adopted the suggestion of Guy Steele(Scheme inventor of Scheme, but Knuth didn't design it well. Knuth believes that machines are unchangeable truths, so he insists on writing TAOCP in machine language. However, due to the lack of abstraction in machine language, programmers can't focus on real problems. Using machine language to describe the algorithm will make the original simple problem seem profound, as if the book will never be finished. How many people have actually seen TAOCP? I'm afraid most people buy this set of books just to save face and put them on the shelf. As long as someone says that machine language is too difficult to understand, these people will say that you are not smart enough to be a programmer. Actually, they haven't seen it themselves. Many people, including Dijkstra, have seen the fact that machines are not the essence of computing. He said: "Computer science is a wrong name because it is not computer science, just as surgery is not knife science." And this is the truth that almost every programming language expert understands. In their eyes, this is no longer hearsay or personal opinion, but a fact that can be proved by logic. People who truly understand the essence of computing can design brand-new hardware to meet the needs of semantics, rather than being controlled by the design of processors. They can even go beyond integrated circuits and use other technologies to make machines. All these show that the calculation is actually independent of the machine. It doesn't matter if you have bad ideas, but if you insist that bad ideas are good, it will hinder the development of history. I don't deny Knuth and Ritchie's important contributions in algorithms, typesetting and operating systems, but because they and their admirers often mislead the language, they feel it necessary to point out some of their limitations. Linus Torvalds, Guido van Rossum, eric raymond and paul graham often comment on language, which is regarded as sacred by many people, but in fact, there are few insights in their speeches. In fact, what I want to say is that most of the idols that programmers usually worship are not real programming language experts. I hope you don't think this is alarmist. In fact, these are things that most world-class computer scientists have known for many years.