Why write such an article? Students who come to our lab to study for a master's degree may have felt that their fate is very miserable since the first day they came here. When they were undergraduates, they majored in mechanical design, manufacturing, and automation, and when they graduated, their resumes at most mentioned that they were good at application software such as MS Word, PowerPoint, UGNX, and AutoCAD. In their limited learning career, they would never have thought that they would have to relearn C language, then C++, and then Python or Lua, and they were not allowed to use Windows, but only Linux, which did not even have QQ and often broke down... In their minds, programming doesn't seem to be that interesting, so they think programming is difficult. I agree with this. Everyone plays small games like Minesweeper and Solitaire in Windows, and many people play Mahjong and Go. I think these things are also difficult. I once told them that if they didn't know how to program, it would be difficult for them to solve the problems in their research direction, and therefore they would not be able to write valuable papers, graduate successfully with a degree, or find a good job... This kind of utilitarian "threat" may be somewhat effective for some people, but if it is unable to make them spontaneously interested in programming, it would be an inexplicable humiliation for any "teacher-like" person. Now I try to tell them that programming is not only not difficult, but also very interesting, and full of many things worth pondering, and these deep thoughts will also bring many benefits to our lives. So, there is this article. Whether you are a programmer or not, you are programming every day, and you are programmed every day. Programming is to design some steps, organize these steps, make these steps run correctly in the current environment, and finally get the desired results. Every day you go through is organized in an orderly manner, including getting up, drinking water, eating, working, going to the toilet, entertaining, and sleeping. You live in this program. This program may be partly compiled by your leader. If you are a leader, you can also compile some programs for your employees. Mechanical design is actually more programming than programming. The so-called mechanical parts are data structures. The so-called transmission mechanism is the application program interface (API). The so-called engine is the core of the program. You assemble the parts and connect them to the engine through the transmission mechanism, so you create a machine. You can make it run by turning on the power or starting the fire. However, programming is simpler than mechanical design. You don’t need to add lubricants to the programs you write frequently, nor do you need to conduct complex mechanical analysis on each data structure, and you don’t need to pay attention to whether these data structures are perfectly matched with each other. At least this is the case with current computer software engineering. It is not based on solid physical laws like mechanical engineering. The structure and operation laws of machinery are always calculable and analyzable, while the structure and operation process of software are full of too many non-rigorous links. This non-rigor creates a space for us to give full play to our talents or engineering practical experience. Obviously, even if there are various non-rigorous aspects in software engineering, we can simulate everything in mechanical engineering through programming. In fact, this is also true. In the field of modern mechanical engineering, software is everywhere. There are many exquisite "algorithms" in mechanical design. Designing mechanisms such as sewing machines, guns, and engines is actually much more difficult than designing algorithms in the computer world, and these mechanisms often have a huge driving force for the development of human civilization. I hope you don't fall in love with mechanical design because of this... Obviously, if you learn programming, you will have a deeper understanding of mechanical design. Because programming treats "design" itself as an intellectual activity. You can apply those intellectual activities in the field of mechanical engineering to programming, and you can also apply the intellectual activities in programming to any design. clipboard.png Before learning programming, you should ask yourself a question: Why do I want to learn programming? Don't hit me... I know you are forced to learn programming, so you might as well be forced to think about "Why do I want to learn programming?" If you don't know the answer, it doesn't matter. Anyway, this question has nothing to do with learning programming. In fact, we have done a lot of things that don't need to be answered. We don't even know the answer to the question "Why do we exist", but we still live in confusion until now. First, I recommend a few introductory books and how to read them, because the least necessary way to learn programming is to read a book about programming from beginning to end... Programming is not an exam, it is a creation based on real life. This kind of creation is gradual, and you may not be able to predict what the result will be at the beginning of the creation. This is the basic attribute of any creative activity. The first book I recommend is "Structure and Interpretation of Computer Programs", or SICP for short. Students with good English reading skills can read the English version. Students with good Chinese reading skills can read the Chinese translation. Teacher Qiu Zongyan's writing skills and the rigor of the translation are commendable. It is recommended to read this book in the following three stages: Read the first two chapters. The first chapter is about the abstract method of the calculation process, and the second chapter is about the abstract method of basic data. The content of these two chapters covers the entire content of the "Nine-Year Compulsory Education" in the software world, and the teaching language used is also a very small subset of the very mature and well-designed Scheme language. In the process of learning the content of these two chapters, you can read the first 10 chapters of "Teach Yourself Scheme in Fixnum Days". This Scheme tutorial also has a Chinese translation. Even if you don't do the SICP exercises, you should look at the questions, think about them, and judge whether you can do them. The answers to these exercises are easy to find on the Internet. Review the C language. The textbook used is "The C Programming Language" co-written by Kernighan and Ritchie, the father of the C language. This stage is mainly for our laboratory. Because students in our laboratory usually have to take the C language course in undergraduate studies, but at that time they may not really learn from the perspective of learning programming. Now they can re-understand the C language through the programming concepts based on the Scheme language in the first stage. Only in this way can they understand the advantages and disadvantages of the C language, and think about how to give full play to the advantages of C, and then use Scheme to make up for the shortcomings of C. With the help of GNU Guile 2, it is easy to achieve C and Scheme composite programming. This process can be interspersed with reading "Programming Practice" written by Kernighan. Read Chapter 3 of SICP, and then find a book about C++, such as the very famous but not very important book "C++ Primer" in the C++ world, and only learn the class-based data abstraction and object-oriented programming parts. At this stage, Chapter 3 of SICP explains two methods: object-oriented programming and functional programming. The object-oriented programming obtained from SICP can be further strengthened in the study of C++. As for the functional programming method, you can pretend that you already know it and make plans when you need it in the future. Finally, remember to finish the rest of "Teach Yourself Scheme in Fixnum Days". For most programming tasks, the knowledge covered in the above books is enough, and the above books are also very readable books. As long as you are not in a hurry to finish them, they are always interesting. I like SICP and "Programming Practice" very much. Because I like them so much, I have never been willing to finish them. Books are meant to be read, but it is best to use your hands while reading. So, you should never stop and ask yourself: Why do you want to learn programming? I hope that one day, you can find an answer for yourself, that is, you want to write a XXX program. This program should at least be useful to you, that is, its main function does not overlap with other programs in your system. If you can clarify this, then the program you create will have meaning, and your learning will have meaning. Why learn programming? Because you are going to create some software that has never been created before, and it can help you do something that you think is important! Whatever you think is important is likely to be important to many people, so what you create can help more people, which means that there will be some people you may not know who need you, and this is where your value lies. The practice of programming should be regarded as an intellectual activity to explore the unknown world. You should jump out of the book and use the experience you have gained from those examples to solve real problems. If you think that there are no problems in reality that need you to solve, then... please answer the question "Why do you exist?" Reading is learning from the correct experience of predecessors. Practice is learning from one's own failures. Since I have decided to practice, I might as well find some difficult paths for myself. Taking a few things that I am personally interested in as examples, I can write a modern literary programming language based on TeX, which can not only improve my programming skills, but also give me some practical understanding of the syntax analysis link in compiler theory. I can also try to write a three-dimensional geometry library that can complete calculations such as convex hulls, Delaunay decompositions, and Voronoi diagrams. I don't seek to be big and comprehensive, but only to be small and precise, so that I can slowly improve it over a long period of time. I can also find an open source project I like, read its source code, understand the project building system it uses, analyze the project structure, and try to modify its code... What I am most interested in now is LuaTeX. If you have already had many practical failures and you have roughly mastered languages such as Scheme and C/C++, then learning a new language every year is not difficult. You may find it strange that there are frequent language wars on the Internet. It is the problem that determines the language, the problem that determines the programming paradigm, and the problem that determines the belief. If you can clearly understand these, then you will not fall into the quagmire of a certain language religion. This is true for many things... People who work in mechanics often believe in UGNX, CATIA, PROE and other "religions"... If I have to find a belief for myself, then I believe that my existence is to solve problems. If I do some highly automated maintenance tasks on the Linux system I use, I don't hate the complicated Bash scripts, but I really appreciate how it can quickly connect several independently running programs like glue to complete complex tasks for me. If I need to do some temporary text processing, I can use Python 3 because it supports UTF-8 very well and has a complete string library. If I just want to replace some text, existing tools such as emacs or sed are enough. If I want to write a serious program, so serious that its life may be very long, then I will choose a mature and stable language to implement it. Even if I use C, I will not be annoyed by its cumbersome codes. I will try my best to condense the functions to be implemented in the program. We are faced with many choices in life, but many people do not seriously examine the problems they face before making a choice. Algorithms are needed to solve problems. Since programming is everywhere, algorithms are also everywhere. However, if you pick up any book about algorithms, you may feel dizzy. Maybe you worry that if you can't even understand a book about algorithms, how can you write programs? When I first learned programming, I wrote small programs such as Twenty-Four Points, Tower of Hanoi, Eight Queens, and Tetris. Later, in real projects, I also wrote programs such as heap sort, quick sort, LU and SVD decomposition of matrices, minimum spanning tree and shortest path of undirected connected graphs. But now, if I want to implement any of them, I still have to read the book to understand the algorithm, and then write the program... What I want to say is that if you are reading a book about algorithms, and there are some algorithms or examples in the book that you cannot understand at the moment, you can skip them. Many books that specifically talk about algorithms are full of mind games. If you cannot put yourself into the context of these games, the rules of the game will naturally be unclear. Now it seems very natural, but at the beginning I doubted my IQ over and over again, especially when I saw many people on the Internet talking about these mind games like drinking boiled water. I once doubted that I was not suitable for programming. Fortunately, the world is stable enough that we can live well without understanding relativity and quantum mechanics. Most people don't even need to understand Newtonian mechanics... The same is true for algorithms, especially now that their implementations already exist, such as the implementation of the quick sort algorithm for one-dimensional data in the standard library of almost any programming language. Basically, as long as the algorithm is very important for real-world problems, you can always find their existing implementations and use them. I am not saying that learning algorithms is unnecessary, I just emphasize that you should not be blocked by algorithms that are difficult to understand at the moment. You are born with some extremely powerful algorithms, which are exhaustive, greedy and divide and conquer, as well as the most powerful "evolution" and "neural network". Those books that specialize in algorithms are just very poor language, symbols and examples to portray your natural intuition. As long as you encounter a problem in reality, you can always find a way to solve the problem, not just reading a book about algorithms to solve the problem. I can't understand many algorithm books. The first chapter of their books is to review mathematical induction, and the second chapter is to learn the time and space complexity analysis of algorithms... I am a person who lacks intuition for mathematics. For me, the only value of these books is that they deliberately prevent me from reading them. Even the masterpiece "The Art of Computer Programming" by Knuth, who is a great god in my mind, seems to have the only purpose of making me feel that I am not an artist. A long time later, when I was wandering around the school library, I found the book "How to Solve Problems: Modern Heuristic Methods". After flipping through it, I began to sigh and wondered why I didn't know about this book at the beginning? Those of us who are not from computer science majors can read some professional books on computer theory when we have time, such as operating system principles, compiler principles, algorithms and data structures. If you can't understand too professional books, or don't have that much time and energy, you can read some popular science books on computer science. There is a book called "Psychic Chip" that is worth reading. It is a thin booklet that can be read in three to five days of spare time. There is a book called "Coding: The Language Hidden Behind Computer Hardware and Software", which is an enhanced version of "Psychic Chip" and is also worth reading. There is a book called "In-depth Understanding of Computer Systems", which looks at the computer hardware and software systems from the perspective of programmers. It is also a very good book, but it takes some patience and time to finish reading it, so it is not necessary to finish it all at once. You can also continue to read Chapters 4 and 5 of SICP. Although your programming skills will not improve dramatically by reading these books on computer principles, these books can help you understand the world in which your program runs. Although you don't know why you exist, you know why this program exists. You not only know why it exists, but also how it exists, and how to make it exist better. In this way, there is no need to waste your limited life on those so-called "XXX Proverbs", "XXX Tao", "XXX Zen" books. If you have time, you can also review The Matrix. Although its director is not a programmer, he is better than a programmer. After watching The Matrix, you can also read Hackers: Heroes of the Computer Revolution written by Steven Levy. Leaping from the technical level to the humanistic level, maybe then you will have a deeper understanding of your life. Computers are the best mirrors humans have created for themselves. Knowing programming is like knowing any other skill. It is nothing special because no skill is more complicated than itself. It is not even as complicated as the weeds on the roadside that you have ignored. Life is a very wonderful thing. Its birth is both accidental and inevitable. If there is only a slight error in the whole life system, I may not be born. And when I confirm that I already exist in this world, I don’t know why I exist. If everyone has thought about the question "Why do I exist?", then it means that our thinking about this question is not spontaneous, but forced. This question has existed in everyone's mind like a brand since we were born. This question is the ultimate question of mankind, and all the problems we solve will eventually point to it. We live for this question. We live not only to answer it ourselves, but also to create living conditions for others to answer it. Others, including our family, our friends, and those we don't even know. Because this question is imprinted in the human mind, and we are part of the human race. Do we work hard to make money in order to live a better life? It seems not to be the case. The rich living conditions only create a better environment for us to think about "why we exist", but even the poorest people in the world will ask themselves questions like why do I exist and why God treats me like this. In front of this question, the rich and the poor are absolutely equal. When we see a beautiful woman, we may be moved and chase her to marry her. Is it for a beautiful love? Maybe beauty is a temptation to ensure that human beings can continue to reproduce and continue to think about the ultimate question; even if it is out of love, it is very likely because the person you love has a beneficial effect on your answer to the question "why do I exist". All living things are born for life. This is life. Life is a state that can change and reproduce itself. As long as there is a thing whose state is changeable, and this state can produce new changeable and reproducible states while maintaining its own changes, then it has life. So what is life? The Chinese character "命" is a bit interesting. It means something like "a person is asking questions throughout his life." What are we asking... naturally, "Why do I exist?" Socrates said that he exists to "know himself", but this does not seem to be the answer, but just a process. In "Generics and Closures", the reason why I sighed "Each of us is like a closure" is that I feel that if we are a function in a program, we ourselves will never know what the result of our operation is. This idea has some fatalistic implications, but the birth of each person is full of accidents. Obviously, even if we are created, our survival activities do not seem to be affected by the creator. Or the creator has no intention of interfering with our activities, so in life we often feel that we have free will. If we are created but have a certain degree of free will, then Socrates may be right. The purpose of the creator trying to create us is to let us "know ourselves". Although we don't know what kind of "calculation results" will be produced when our lives end, the creator can understand these results. We have the freedom to live actively, and we also have the freedom to be negative and decadent. We have the freedom to explore knowing ourselves as the ultimate problem, and we also have the freedom to commit suicide by completely not cooperating with the creator. There is also a possibility that the creator no longer exists, and the entire universe system may be just an abandoned ruin, or he just took a nap in front of the machine... It is easy to find that if we trace the problem back to the origin and then evolve from the distant point to the present, it is not difficult to draw a Socratic conclusion. Since we are still alive and since we are asking the meaning of our existence, the answer naturally points to "knowing ourselves". Life is just a process for me. In this process, the only thing we can observe is the change of our own state. As for whether the change of state has already happened and is just being replayed, or is happening, it seems very unimportant because we cannot jump out of this change of state. This may also be the fundamental reason why OOP is easier to understand than FP, and I don’t think FP can effectively solve concurrency problems as everyone expects. If you start to get a little obsessed like I did, then in order to find the answer, it is necessary to read some books on philosophy, physics, biology, etc. Maybe you should read some philosophy books. If you have never thought about reading philosophy books, I recommend a book called "Sophie's World" that 14-year-old boys and girls should read. Don't hit me. Although Russell's "History of Western Philosophy" is from his personal perspective, it is obvious that our understanding of philosophy is difficult to reach his level. Since we are not planning to achieve anything in philosophy, "History of Western Philosophy" is enough for us to read. Review physics. The first volume of "Feynman Lectures on Physics" is very good. Feynman covers almost everything about the world that humans can perceive, just like telling a story. If you can't even understand Feynman's book, you might as well take a look at "The Shape of Time" + "A History of Quantum Physics". They are very excellent popular science books written by Chinese in recent years on relativity and subsequent physics. Another book I often read in college is "From One to Infinity". Although it is quite old, it is still an excellent popular science book on physics. Biology was one of the courses I hated the most in middle school. I couldn't understand the illustrations in the books, and there wasn't even a microscope or real specimens in the rural middle school, so I was a biology illiterate for a long time. I couldn't even name many common flowers, plants, trees, birds, animals, insects, and fish, let alone which phylum, class, order, family, genus, and species they belonged to. But there was one biology book I could still understand - "Comics on Genetics", which was a very good popular science book on genetics. I bought it to learn genetic algorithms, and it caught my eye from the first page. But, to be honest, after reading all these books, I still don’t know the answer to the question “Why do I exist?” But I have thought more about programming. Especially recently, the idea that quantum mechanics reduces the movement of elementary particles to a probability problem has greatly inspired a problem I have been working on solving. I have read all of them, but I haven't finished some of them. I have finished some books, but it has been a long time, and I have forgotten some of them. I have been wanting to find some time to reread them. Some books are so good that I can't bear to finish them all at once. It may sound hypocritical to say so, but it's the truth. For example, Feynman's Lectures on Physics, although Feynman, known as the Peter Pan of the physics world, has turned profound physics into human language that I can understand, on the one hand, I am not a professional physics researcher, so I don't need to rush to finish his book. On the other hand, once I finish reading it, I will regret that there will be no second season... I plan to keep these three volumes of Feynman's Lectures on Physics for me to read slowly in the future, and I can also tell this knowledge to my son. Some books are too difficult for me. Even if I think I have finished reading them, after a while I find that it is the same as not having read them at all. I can only classify these books as books I have not finished. For all the books I read, I think the authors have gone further than I have in the direction covered in the books. But I never think that I can't go further than them because I can't understand their books. Because the authors of these books always have some books that they can't understand. |
<<: Which one is the future, Web or APP?
>>: Top 10 Weird Psychological Characteristics of Social Networking Site Users
Let’s first talk about the formation and position...
Recently, an asteroid numbered 2022 AP7 was notic...
For some food connoisseurs, cooking by themselves...
Price is an important means of competition. Prici...
What are the things to pay attention to when leas...
In this era where everyone is competing for atten...
How do you start to create an offline event? 1. T...
In the past few years, the Internet industry has ...
About the author: Bao Xiehao, Xiaomi MIUI departm...
Your familiarity with channels means whether you ...
Feishu-9 Lectures on Digital Tools for Organizati...
When sailing at sea, what is the real "stabi...
The M1 chip released by Apple last year shocked t...
Usually, there are very few women around me who e...
Ding ding ding ~ Fantastic beasts are coming!...