Why You Should Learn Linux
Note: The target audience of this article is computer science students and friends who wish to delve deeper into computers.
Today I attended the Windows Azure Camp of Microsoft Student Summer Camp, from approximately 16:00 to 21:30. There were 10 teams, each divided into four groups, among which the Coding group had compulsory and optional questions. The compulsory question was to build a web application on the Windows Azure cloud platform, where users upload pictures, rotate the pictures and display them to the user, and save them to cloud storage. The optional question was to splice the user’s original picture and the rotated picture into one picture. (I didn’t listen to the question, it might not be accurate, please forgive me)
I didn’t work in my own team, but wandered around the venue, chatting with contestants from various teams and seeing what everyone was doing. At first glance, it seemed a bit like the ACM competition.
First of all, let’s clarify that not everyone in the picture above is in the Coding group, and the task of most people is not to write programs. The Coding group of each team is 3~7 people, and some teams are not programming on the spot.
The first phenomenon: Many people in the Coding group didn’t bring their laptops. This reminds me of the LUG weekly gatherings, where most people come to listen to technical lectures without hands-on operation, and the result is like listening to the wind. Domestic computer education is mainly theoretical teaching and written examinations, and computer experiments are often muddled through, so many computer science students have not developed the habit of hands-on operation.
The second phenomenon: Can’t search for technical documentation. There were quite a few people on the scene staring at the Visual Studio interface “thoughtfully”. Upon asking, it turned out that they didn’t know how to use the API, or the API didn’t work as expected. Most people do know to Baidu, Bing, or Google, but most of them search in Chinese, and most of the search results are on CSDN, and the quality can be imagined. They paste the searched code into it, and after finally correcting the syntax errors, they find that it doesn’t work, and they are at a loss.
I remember when I first came to MSRA, famous blogger Liu Weipeng gave a report, saying that we should only read carefully selected good books and good articles to ensure the quality of information sources; English should be the first language of programmers all over the world, not the second language. I think that every student who aspires to be a programmer should learn to search for technical documentation.
- Try to use English to search in international search engines;
- Prioritize reading official API documentation, and seek help from unofficial materials when you find that the official documentation is not clear;
- Identify high-quality technical discussion sites, such as StackOverflow, MSDN.
The third phenomenon: Can’t use debugging tools. I discovered this problem in the experimental class at school, most of my classmates are printf party. This activity is difficult for the printf party, Web interface, where to printf? Of course, you can output information to the Web page, or use VS’s TRACE to output to the debug window. But even printf has its tricks, such as using “binary search” to locate the error position. In fact, VS has built-in powerful breakpoint debugging functions. After stopping at a certain place, hovering the mouse over the variable will display the value of the variable, and complex objects can even be displayed in a structured way. This level of convenience is hard to match even for gdb under Linux.
After a few rounds, I fell into contemplation. Microsoft awards generous scholarships to select “Microsoft Scholars” at well-known universities, and has also spent a lot of manpower and resources to organize the Microsoft Student Club. This event is an invitation from Microsoft for scholars and club students to participate. A reasonable guess is that the students who come to participate in the event represent university students with relatively high computer skills. However, there was no ACM atmosphere at the event.
After so much complaining, it seems to have nothing to do with the title of this article “Why You Should Learn Linux”. Let’s get to the point.
Windows operating system is aimed at end-users, encapsulating many technical details that ordinary users do not need to know. For commercial considerations, Windows software developers are unlikely to disclose too many technical secrets. Even if we want to understand its internal principles, we can only get a glimpse of the leopard from its external behavior. Therefore, I greatly admire the hackers who study Windows. They use disassembly and debugging tools to understand the machine code that has already removed symbols and semantic information. I can’t do it at all.
The Linux system is accurately called the GNU/Linux system. Linux is the operating system kernel, and the GNU project provides a set of user-mode toolchains, which together form the GNU/Linux free operating system. One of the characteristics of “free” software is open source, that is, the source code of the software can be freely obtained. This provides convenience for us to learn and research the operating principles of software.
The GNU/Linux system also inherits the toolchain of the UNIX system. Each tool is like a Swiss army knife. Through the combination of command line options and “pipes”, it can express exponential possibilities. This means that a line of shell script can do more than many lines of C code. This kind of “easy programming” also gave birth to the “hacker culture”, that is, not to regard programming as a “high in the temple” serious process, but as a means to solve daily problems - it’s something that can be done in half a day, why bother writing documents and making development plans?
Therefore, Linux system is the preferred platform for various open-source programming languages (I consider those whose official compilers are maintained by the open-source community as open-source programming languages), such as Python, Ruby, Node.js, Haskell, PHP, etc. Compared with languages like C, C++, Java, the most intuitive feature of these languages is that “Hello World” only needs one line, and the more essential feature is that these languages have stronger abstraction capabilities. Learning these languages is like a child learning to express abstract concepts, which can express relatively complex programming models and data structures more concisely and intuitively. Even when using traditional languages like C, these relatively advanced structures can be used as building blocks for more complex software.
Due to the sharing culture of the open-source community, these open-source languages all have many open-source libraries (library). It is very likely that a hobbyist on the other side of the world has already solved the problem that has troubled you for a long time and shared the solution selflessly. This sharing allows everyone in the community to stand on the shoulders of predecessors and make rapid progress.
I won’t advocate “working entirely with Linux” like Wang Yinyu. In fact, my current desktop environment is Windows, because I really don’t want to bother with those incomplete support drivers, desktop environments full of bugs, and Windows-only application software. For programming, I write, debug, and run in cygwin; if a graphical interface is needed, I write in vim and compile and debug in Visual Studio (it is said that VS has a vim-like plugin, I haven’t tried it yet). The main things I haven’t adapted to are network configuration and process management. I haven’t found tools as handy as Linux yet. When I get rid of being a loser, I will see if Mac, a system that originated from UNIX and focuses on user experience, can combine the advantages of Windows and Linux.
Regardless of the daily work environment, I strongly recommend computer science students and friends who want to have a deep understanding of computers to learn Linux, understand the principles behind operating systems and various application software, treat coding as a habit, learn to search for technical documents and use debugging tools.
Finally, share a thinking question similar to the one at Azure Camp: Set up a Wifi hotspot, so that the pictures displayed by the neighbors who are mooching off your network are upside down, while the pictures you see are normal.
I first saw this question in a book about geek culture. I didn’t expect that someone had already written an answer online (it seems that this article is quite old):
http://www.ex-parrot.com/pete/upside-down-ternet.html
However, this method of modifying the URL is only effective for HTTP. HTTPS is ineffective because it is encrypted. Fortunately, most HTTPS websites distribute static images through CDN, and CDN generally uses HTTP (unencrypted). Therefore, by detecting the HTTP header, intercepting images with Content-Type as image, processing them upside down, and then sending them to users, perhaps it can be done more thoroughly.