Hello, C++ (2) 1.3 C++ world map 1.4 How to learn C++ well

1.3 C++ world map

The development process of the C++ language is not only a process of increasing features and enriching content, but also a process of constantly conquering cities and territories in the application field. During its more than 30 years of development, C++ has been widely used and developed in multiple application fields. Whether on the original UNIX/Linux operating system, on the Windows operating system, or even on the recently emerged embedded systems, C++ occupies an irreplaceable place, as shown in Figure 1-3.

Figure 1-2 The C++ world is divided into three parts

1.3.1 C++ development under Windows system

Ever since Gates completed Windows 1.0 using C/C++ in 1985, C++ has been closely associated with the Windows operating system. Not only is the bottom layer of the Windows operating system developed using C/C++, but most large-scale software running on the Windows operating system is also developed using C++. It can be said that the blood of C++ flows in the Windows operating system. Although there are many programming languages ​​​​on the Windows operating system, C++ still has an unshakable position on the Windows platform with its unique advantages and historical accumulation.

1. Unique advantages

The Windows operating system itself is developed in C/C++. The close relationship between the two makes C++ call the Windows API (Application Programming Interface), which is usually some functions predefined by the operating system or programming framework in order to It has a natural advantage for programmers to access the functions provided by the system). Therefore, when developing programs related to the Windows operating system, C++ language is often given priority.

2. The accumulation of history

Due to historical reasons, many applications running on the Windows operating system are developed using C++, and these applications still need to be maintained and upgraded. Therefore, C++ has a first-mover advantage on Windows operating systems.

1.3.2 C++ development under UNIX/Linux system

If there are other competitors to C++ under the Windows operating system, then under the UNIX/Linux operating system, C++ is almost the only choice of development language.

As a programming language, C++ has very obvious advantages under the UNIX/Linux operating system. First of all, the UNIX/Linux operating system itself is developed in C/C++ language, which makes the operating system itself very friendly to C++ development. In addition, most of the UNIX/Linux operating systems are server-side applications. These applications emphasize high performance and high security, which are precisely the strengths of the C++ language. Most applications on UNIX/Linux are developed using C/C++, such as the famous network Web server Apache, database server MySQL, etc. Therefore, if you want to develop applications on the UNIX/Linux operating system, which requires higher performance and faster development efficiency, then C++ must be the preferred development language.

1.3.3 C++ development under embedded systems

With the popularity of various digital products, embedded systems have gradually become a popular development field. The special hardware limitations of embedded systems make embedded systems have special requirements for development languages. For example, due to the small instruction set of the execution unit, only development languages ​​with relatively simple syntax can be implemented; the memory capacity of embedded systems is relatively small, requiring good memory management; the CPU frequency of embedded systems is relatively small. Low, the executable code is required to be concise and efficient; at the same time, in order to improve development efficiency, high-level development languages ​​are required to be used, etc. These stringent requirements for development languages ​​​​of embedded systems cannot trouble the C/C++ language at all, and they are exactly the advantages of C/C++. The syntax of C/C++ is relatively simple and can be implemented on embedded systems; it is close to the bottom layer and can manage memory well; the executable code generated by its compilation is simple and efficient; it is a high-level programming language, and its development efficiency can be Guaranteed. C/C++ satisfies the stringent development language requirements of embedded systems and has almost become the only choice for embedded system development.

1.4 How to learn C++ well

Since C++ is so powerful, how do we learn C++ well?

Almost every C++ beginner will ask this question. However, there is no so-called standard answer to this question. As a tour guide in the C++ world, I can introduce some knowledge and experience to everyone, so that everyone can avoid detours, move in the right direction, and complete the wonderful journey of the C++ world easily and happily. As long as we grasp the following two principles, as for the specific learning methods, we need to find them ourselves.

1.4.1 “Read more, write more, think more” is the only way to learn C++ well

C++ is a very practical technology, and we cannot learn C++ just by reading a few books. Do you still remember that when we were learning English, the teacher always taught us to "listen more, speak more, read more and write more"? Similarly, learning C++ also needs to emphasize "listening, listening, reading and writing." For programming languages, although there is no "listening" and "speaking", "reading more" and "writing more" are equally applicable. Coupled with "thinking more", this is the only way to learn C++ well.

1. Read more

Reading more emphasizes reading more and learning other people's excellent code, especially the source code of some excellent open source products (for example, text editor program notepad++, FTP file transfer program FileZilla, etc.). By reading these source codes, you can not only learn the specific language knowledge and development techniques used, but also learn its design ideas, programming style, etc. As the saying goes, "If you are close to red, you will be red; if you are close to ink, you will be black." Learning from masters is the shortcut to becoming a master.

2. Write more

Writing more means practicing more development. Programming is a skill that comes from practice and must return to practice. You can't learn programming well by talking on paper. Writing more includes many aspects, such as completing example programs in books in a development environment, re-implementing routines on the Internet, developing and implementing some small programs, etc. The purpose of reading more is to learn other people's knowledge and experience, and the purpose of writing more is to internalize other people's knowledge and experience into your own. At the same time, through writing more, we can discover in practice many problems that are hidden in the process of "reading more", making our knowledge and understanding more profound. At the same time, by writing and debugging programs yourself, you can gain valuable first-hand development experience, cultivate your hands-on skills, and become a true master.

3. Think more

Achieving the above "read more and write more" can make us a good development programmer, but it cannot make us a professional software engineer.

"Read more and write more" emphasizes the ability to implement code. However, if you want to become a professional software engineer, just writing code is not enough. We must also have the ability to design, to abstract problems, analyze them, design algorithms, and finally use programs to solve problems. And "think more" is just to teach us the lesson of design.

Simply put, every component (class or function, etc.) of an excellent program is specially designed to solve a certain problem. So, when faced with excellent code, what we need to think about is, what is this problem? Why is it designed like this? Is there any other better way? Only in this way can we understand why excellent code is excellent. When encountering similar problems, you will draw parallels and design equally excellent code.

In this world, there has never been a programming language that can be learned by just reading one or two reference books, just as no one can learn to write novels just by reading "Introduction to Novel". We must continue to read, learn, and think about other people's excellent codes, and continue to practice it ourselves, coding to the end, in order to truly master a programming language.

1.4.2 Make friends with Google

In development practice, rather than saying that programs are compiled, it is better to say that they are "searched". During actual development, if you encounter a grammatical detail problem, you can use Google to search for tutorials about C++; if you encounter problems with the use of functions, you can use Google to search for the documentation of the function; if you encounter common problems For development tasks, such as opening and reading a file, you can use Google to search for existing sample code. Even when you encounter a problem in the program, you can also use Google to search if anyone has encountered the same problem and see how others solved it. In short, programming development activities cannot be separated from Google. The Internet is like a big gold mine, and Google is the mining machine. Making good use of Google and making friends with Google can help us make full use of rich network resources to learn C++ well and use C++ well.

Learn more: How to "FQ" Google

Due to well-known reasons, although Google is the most useful website for every programmer, it has not been directly accessible in China. In order to access Google, programmers have to go through a lot of troubles, some use paid VPN, some use http proxy as a transit, and some use special browsers with built-in "FQ" function. These methods are either too expensive or too cumbersome. A simpler and more practical method is to first change the system's preferred DNS server to 42.120.21.30 (the DNS server provided by the OpenerDNS project, which can correctly resolve Google's URL), and then access https://www.google.com URL, you can access Google through the encrypted HTTP protocol, thereby avoiding being blocked by the firewall and achieving normal access to Google.

Guess you like

Origin blog.csdn.net/m0_69824302/article/details/135034994