Journal

Learning Computer Science at the Undergraduate Level

2009·06·27

Machine-translated from Chinese.  ·  Read original

Original Post on Wuse Tutu BBS

Original Poster’s Post: I’m a sophomore majoring in mathematics. Actually, I’m interested in computer science, and I’ve been fascinated with it since my first encounter. However, when I took the college entrance exam, I didn’t think too much and ended up in the math department, which seems to offer an easy transition to other fields (but in reality, the coursework is very challenging).

Now that I’ve thought it through, I’ve decided to study computer science. Although I don’t have the opportunity to change my major, I want to take as many computer science courses as possible and learn as much as I can. That’s why I’m seeking help here, hoping to get a copy of the computer science department’s course schedule for next semester and meet some computer science majors. I’m also interested in attending some of their classes. Additionally, I want to focus on programming, specifically network programming or mobile app development.

Currently, my computer science foundation is very weak. I’ve only taken a basic computer science course (which I don’t think is very useful), C programming (I got a perfect score on the final exam, but I think the exam was too easy), and MATLAB (which can’t even be considered a computer science course, and I got a 90% on the final exam). I know I should learn about databases, computer principles, assembly language, computer networks, computer systems, and Java. Next semester, I’ve also enrolled in data structures and computer networks courses. However, I still feel that my self-study is too amateurish, and I want to learn from professionals.

During the summer break, I want to work hard to fill in the gaps in my knowledge so that I can attend computer science classes when the semester starts. Therefore, I want to know more about the computer science department’s curriculum. Specifically, I want to know what courses are offered in the first and second semesters.

Additionally, I’ve taken discrete mathematics and numerical analysis in the math department, which should be helpful for computer science. My math foundation is still decent, and my grades are good enough to rank me among the top in my department. However, our school’s math department is not very strong, which is a fact.

My Response:

I’m not a computer science major either, but I’m also interested in computer science (especially hacker techniques^^, which are very cool). After three years of university, I’ve accumulated some experience, and I’d like to share my thoughts. Please correct me if I’m wrong.

As zengjing said, the most important thing in learning programming is to grasp the underlying ideas. Once you understand the ideas, you’ll find that all programming languages, such as C, C++, Java, Assembly, and Python, are designed based on those ideas. All you need to do is remember the simple syntax. Therefore, if you want to learn computer science well, you should focus on understanding the object-oriented (OO) and functional programming (FP) ideas during your university years. Mastering one programming language is enough.

Looking at your exam scores, I can see that you have great potential for learning computer science (although getting a perfect score isn’t easy, it requires attention to detail and good analytical skills). As a math major, you naturally have an advantage in math. I think you should make the most of your strengths.

In terms of computer science learning, MIT students used to take a course called “Structure and Interpretation of Computer Programs” (SICP) in their first year. This course teaches the Scheme programming language (similar to Lisp) and covers a lot of FP content. This book is a classic, and reading it requires a good math foundation. Now, Peking University’s math department has also started offering this course to undergraduates. I suggest you buy this book (中文版资料及评论) and watch the MIT teaching videos online. You can also find the answers to all the exercises online. If you can get through this book, you’ll have a good grasp of FP ideas. Don’t underestimate FP; there’s a language called Erlang that uses FP ideas, and it’s very important in parallel computing. You can see how prevalent multi-core CPUs are now, and most programs can only use one CPU, lacking parallel processing capabilities. You can search for more information on this topic and decide whether you need to learn it.

Next, I recommend learning C++ or Java, which are based on OO ideas. OO ideas are very important and widely used. Since you haven’t learned C++ or Java yet, it’s essential to learn these languages. Don’t try to learn everything at once; focus on understanding the OO ideas first. Once you grasp the OO ideas, you’ll find that you can understand almost all the popular programming codes (even if you don’t know the syntax details). For OO learning, I suggest you search online and create your own learning plan. I learned VC++ during my first summer vacation and got a glimpse of OO ideas (I read Sun Xin’s book and watched his videos), but I didn’t fully understand it. Later, in my second year, I took a Java course taught by Lei Hongzhou and learned OO ideas again (I felt like I finally understood it). Finally, in my second year, I took a C++ course and learned about classes and objects again – this time, I really mastered it (thanks to the exams^^). You can refer to my experience, but I strongly advise against learning VC++ first.

As for books, I recommend Sun Wei Qin’s “Java Object-Oriented Programming” for Java, and Tan Hao Qiang’s “C++ Programming” for C++ (谭浩强的《C++程序设计》). Note that Tan’s book is a thinner one, and I think it’s well-written, especially since Tan doesn’t repeat the C language basics you’ve already learned. Instead, he directly introduces you to the OO world.

Book links:

After discussing the two important ideas, I’ll talk about how to leverage your math strengths. I think the connection between math and programming is through data structures and algorithms, so you should focus on these areas. For data structures, I suggest you learn it in advance, as I don’t think the course will be offered easily (I enrolled in it for three semesters, and it was finally offered because a few students from the School of Electronics needed it). The textbook I used is http://www.douban.com/subject/2013616/, which uses C++ and STL. If you haven’t learned C++, you might find it challenging to understand. There are many other good data structure books that don’t rely on any specific library, and I think they’re worth reading. Data structures might be a bit dry, but they’re essential.

For algorithms, I’m a complete beginner (my math is poor), but I’ve been wanting to learn it recently. I recommend the following books:

The most effective way to learn algorithms is not to read books blindly but to solve actual problems. I strongly recommend registering on these two websites to practice:

(Note: the original text does not provide the links to the two websites, so they are not included in the translation)

Zhejiang University ACM: http://acm.zju.edu.cn/onlinejudge/ Peking University ACM: http://acm.pku.edu.cn/JudgeOnline/

These two websites have a large number of problems. After completing each problem, you can submit your code for judgment to see if it passes. Only after completing all the problems on these websites can you be considered an algorithm expert. Take your time to practice and improve your skills :)

Finally, I’d like to add a few more points, although they may not be well-organized or entirely correct:

  1. To learn computer science well, you need to use Linux. For more information, visit the Linux section. It’s essential to install a dual-boot system rather than using a virtual machine. You should do most of your programming on Linux.
  2. In the internet age, it’s crucial to learn web development. This is an important aspect of showcasing your skills. You should master HTML+CSS+PHP and have your own blog or website.
  3. Python is a great language that can be used for many tasks, especially for quickly developing small tools. I recommend learning it (it’s a very simple language).
  4. Assembly language is not that important unless you want to develop system-level applications, work with hardware, or become a cracker. If you need to learn it, I recommend starting with Wang Shuang’s “Assembly Language”, followed by “Computer Level 3 PC Technology” (which is an exam, not a book), and then “The Art of Assembly Language”. However, I suggest only gaining a basic understanding, as this is not your area of expertise, and you shouldn’t spend too much time on it.
  5. Mobile app development uses Java, but I’m not interested in it, and I don’t know much about it. Moreover, I’m not optimistic about its prospects :)
  6. As for databases, it’s enough to know how to use them. If you want to become a DBA, you can delve deeper into the subject. Otherwise, it’s sufficient to learn basic CRUD (Create, Read, Update, Delete) operations during your university years.
  7. The quality of university teachers varies greatly. Don’t rely solely on elective courses for your learning plan. Computer science is a field of study, not just a major. Books, online videos, online resources, and hands-on programming are essential. Teachers can only guide you to the door, but it’s up to you to enter and explore.
  8. If you don’t believe what I’m saying, think about how many MATLAB commands you still remember :) Can you confidently say you’ve mastered MATLAB? Reading books and practicing are crucial.

zengjing (another expert’s response): Actually, computer science requires a strong mathematical foundation, especially if you want to delve deeper into the subject, such as theoretical computer science, which can be considered a branch of mathematics. You can google terms like Turing machines and recursive functions to discover many interesting things. If you want to learn computer applications, you may not need to study as deeply. The core computer science courses include operating systems, compiler principles, data structures and algorithms, programming languages (such as C, C++, and Java), discrete mathematics, and network fundamentals. Many people in the computer industry are just coding workers, which can be tedious and doesn’t pay well. In my opinion, since you’re still in your second year, you have a lot to learn and should focus on building a strong foundation. Don’t be superficial or follow the crowd. Learn mathematical analysis, linear algebra, abstract algebra, real analysis, complex analysis, functional analysis, and topology, as these will be useful for the rest of your life. The computer industry may seem trendy and rapidly changing, with new technologies emerging all the time, but I can tell you responsibly that these new technologies are essentially just old wine in new bottles. No matter what language is popular today, computer languages are essentially Turing-equivalent, meaning you can accomplish tasks with any language. The difference lies in the design philosophy and optimization for different development needs. Therefore, learning C, which is a fundamental system development language, is still useful, and you need to put in effort to master it. As for Java, which is object-oriented, mastering the underlying concepts is more important than the language itself. Additionally, generic programming and frameworks are not difficult to understand (you can search for more information), and Java provides a wealth of libraries that can greatly reduce the burden on developers, making us more “lazy”. However, it’s essential to implement basic algorithms yourself, as relying solely on libraries will only make you a novice programmer who can only assemble blocks. It’s crucial to practice hands-on, regardless of whether you’re learning mathematics or computer science. There are many experts online, such as the owner of this blog: http://blog.youxu.info, who is a Ph.D. in computer science and turned down a Google offer to study in the United States. You can see the depth of his articles and his passion for his field. Learning requires passion and proactivity, not just passive acceptance. Recently, there’s been a lot of discussion about the minimum Manhattan network problem, which was solved by a computer science student from Fudan University. It’s worth thinking about. Douban is also a great resource, as it shows you what books people are paying attention to.

Oh, I almost forgot to mention that the internet we use every day is essentially an application of graph theory and optimization algorithms. Learning to see problems from a mathematical perspective will be a valuable asset for your entire life.

PS: You mentioned wanting to learn network programming. You can start by reading the first two volumes of “TCP/IP Illustrated” to build a foundation, and then find a book on Windows network programming. You can also check out China-Pub or Amazon. For computer organization courses, which can be dry for beginners, you can read “The Secrets of Coding” to make it more accessible. Assembly language is a tool for code optimization and reverse engineering, but I’m not an expert, so you can check out the recommendations on CSDN.

苍蝇’s response: The previous experts have said it well: building a strong foundation is the most important thing.

Mathematics is the foundation, and computer science uses a lot of mathematical concepts, such as linear algebra, which is used in computer graphics; discrete mathematics, which is used in databases, combinatorics, and graph theory; numerical computation methods, which are used in algorithm optimization and scientific computing; and probability theory, which is used in security and encryption.

English is also essential, as most cutting-edge articles and technologies are written in English. You don’t need to be fluent, but you should be able to understand English texts with the help of dictionaries like Kingsoft PowerWord.

Here are some books that I think are excellent and worth referencing:

For assembly language: The textbook used in university is well-written, but I couldn’t understand it. There’s a book called “Professional Assembly Language” that’s a good resource, but it’s recommended to have prior knowledge of C.

For C: Tan Haoqiang’s book is excellent, and you should read it multiple times. Another good reference is “High-Quality C++/C Programming Guide”, which is a book that will make you feel ashamed of your current skills. You can also study API documentation, such as “POSIX Programmer’s Guide” and “The GNU C Library Reference Manual”.

For Java: It’s currently the most popular programming language, and it’s widely used. I recommend “Core Java 2 Volume” and “Java and Patterns”.

Operating System Aspects

Personally, I think Linux and Unix are the directions for programmers, so the recommendations are all Unix-like.

  • Understanding the Linux Kernel, 3rd Edition
  • Linux Kernel Development Second Edition
  • Unix Environment Advanced Programming
  • UNIX Design and Implementation
  • Operating System - Threads: Optimizing threaded MPI execution on SMP
  • Operating System - Threads: Implementing Lightweight Threads
  • In-depth Understanding of Linux Virtual Memory Management
  • PRENTICE_HALL - Understanding The Linux Virtual Memory Manager
  • LINUX Kernel Source Code Scenario Analysis

Networking Aspects

Nowadays, networking is inseparable from learning computers, so it’s very important. The textbooks used in school are too outdated, and it’s best to find external resources to learn. For example, Cisco’s networking textbooks are very comprehensive, such as IP Advanced Routing and TCP/IP Detailed Explanation (3 volumes). The T/TCP in the third volume can be skipped to save time. Unix Network Programming (2 volumes) is also a good resource.

Learning a Scripting Language

Learning one scripting language, such as Python, Perl, or PHP, is enough. Python is currently the fastest scripting language; Perl is a bit outdated and has strange syntax, but once mastered, it’s very convenient and can accomplish a lot with minimal work. PHP is widely used in web development and is also very useful as a scripting language. It’s essential to learn how to use sh; I recommend the book advance_bash_script_progaming_guide.

Data Structures and Algorithms

These are crucial and not easy to master, but mastering them will bring lifelong benefits. Here are a few book recommendations:

  • Data Structures by Peng Bo is a good textbook, despite having many errors. Read it more than ten times, and occasionally flip through it.
  • Introduction to Algorithms - I haven’t finished reading it because my math skills are not good.

Other Topics

  • Design Patterns
  • Software Engineering
  • And so on.

Of course, these are mainly extracurricular readings. It’s essential to grasp the required and elective courses thoroughly.

There are too many books to read and too much knowledge to master. I suggest learning while practicing and finding a part-time job or project to work on, such as building a small website or finding a part-time job.

留 · 言