Java programs must run on virtual machines. C ++ is not a language, and C ++ code runs directly on physical machines, the so-called C ++ language is a widely used computer programming language ..
C # It is more like the product of the commercial struggle between Microsoft and SUN. Historically, Microsoft has supported the Java language and representative products include Visual J ++ and WFC. Later, Microsoft launched C # For a well-known reason, with a clear goal of competing with Java.
In fact, C # and Java are very similar in terms of features, not just syntax ). Both of them provide mature solutions for GUI, database access, network communication, multithreading, and other closely related aspects of actual applications to facilitate application solutions.
C ++ relies more on third-party libraries to implement these functions, because C ++ is an international standard, it takes a long time to add application-oriented features other than these languages to C ++. C # and Java are owners of commercial companies, and various actions are naturally much more agile.
But this does not mean that C ++ is about to die out ). It is undeniable that C ++ has lost some fields in the C # and Java attacks, but C ++ is still widely used, the important reason is that C ++ not only maintains the efficiency of C language, but also adds the object-oriented feature.
Main differences between C ++ and other languages
In general, the differences between C ++ and C # and Java are as follows:
1) C #, Java code is compiled to form intermediate code) is executed on the virtual machine. C ++ is not.
2) C # and Java are relatively simple and easy to use compared with C ++. C ++ has many syntax features and is difficult to grasp.
3) The C ++ language itself is a standard. There are differences between various implementations, and the understanding and implementation of the standards are also different. The C # and Java languages are mastered by commercial companies, and there are few problems in this regard.
4) C # and Java are directly oriented to applications, and various standards and models are mature. The various libraries of C ++ may encounter some problems in different C ++ compiler implementations.
5) all three are object-oriented. C # and Java are more thorough than C ++. Some people think that C # and Java are completely object-oriented languages. This is inappropriate because there is no specific standard for object-oriented languages, for example, some people think that the recently popular Ruby language is more object-oriented than C # and Java.
6) C ++ has many modern and exciting language features, such as templates and generic programming. At this point, C # and Java are also following up quickly. C ++ is an exquisite and artistic programming language. The author believes that C ++ is also one of the most flexible and difficult languages in all known programming languages. Learning C ++ also means learning any other advanced programming language. Figure 1.1 compares the four languages C, C ++, C #, and Java.
First, repeat Bjarne's statement: "Our system is already extremely complex. To avoid the complexity of C ++, we simply don't need the C ++ Linus approach ." In all areas where C and C ++ are available, C ++ is a better language than C. When I say "better", I mean C ++ has a safer type check, better abstract mechanism, and better database than C. Of course, there are exceptions in everything. If project 1 you are working on is not large. 2) No abstract mechanism is used in encoding.
Even the ADT abstract data type, such as std: complex, which does not contain polymorphism and inheritance, is not used, RAII is not used, and exceptions are not used. 3) You don't need to connect to the basic library, such as smart pointers and containers that simplify resource management. Maybe you can use C. If you do, you don't have to argue with me because I can't refute you. The fields we are talking about here are roughly the areas listed by Bjarne in the "C ++ Application List.
The bottom line is: Remove unnecessary complexity from C ++, leave essential and important language features, simplify the language model, and eliminate historical burdens. Even the opponents of C ++ may have difficulty finding a reason to say "I still don't need C ++ ". In my opinion, there is only one reason for rational opposition to C ++ in a practical sense: the confusions brought by the complexity of C ++ offset or even exceed the benefits of the abstract mechanism and library of C ++ in his specific project.
It is worth noting that a trap needs to be avoided here, that is, once people determine that "C ++ is not good", this reason will "grow your feet", that is, even if we get rid of the complexity of C ++, they may insist on still not using the C ++ language, and find a bunch of reasons for it.
I assume you are not such a person. However, perhaps most likely, he would say, "The problem is that the C ++ we are using today is not so concise.) your assumptions are not true ." Yes, my assumptions are not true. However, although we cannot eliminate complexity, we can avoid complexity and short-term growth. This is also the main point of this article. I will discuss it later.
Of course, you may say it now. I still don't need the C ++ language, because I can use D. Or, if you don't need C ++ for a project, you may say that I use Python. First, if your project can be implemented using Java, Python, or Ruby, then using C ++ is a tough option.
What is the value of using a language that represents your project in terms of efficiency is not demanding, so you cannot find too many benefits in terms of efficiency and complexity? Second, if your project efficiency is very important, you may say you can use D.
However, the reality is that D is rarely used in the industry, especially in China. The C ++ language has a lot of existing code. Companies that have already used C ++ for their products cannot rewrite the code in other languages for a long time, as Joel said, he decided to rewrite an extraordinary code base = to commit suicide.
- Introduction to C ++
- Summary Notes on learning and exploring C ++ library functions
- Basic Conception and method of C ++ Class Library Design
- Does C ++ really have market value?
- Basic Conception and method of C ++ Class Library Design