?? Most people agree that C + + is a very complex language, but how complex is it? As a result of curiosity, I compared the C + +, Coffeescript, Ruby, the language of the necessary functions as a criterion for the complexity of evaluation. Although both Coffeescript and Ruby are dynamic languages, which are clearly different from C + +, they are multi-instance languages and (at least to some extent) support object-oriented, functional, procedural, and general programming, so this article can be simply understood as C + + vs. dynamic languages.
The concepts that are compared here include both classes and operations, as well as details such as the If-else state and the while loop. Comparing the complexity of languages from different angles will certainly vary greatly, so these numbers can only roughly reflect the complexity of the language. But anyway, I think I got some interesting data.
Again, I'm interested in other static languages, like F # and Scala, but I'm not familiar with them, so it's hard to make the right comparisons.
Coffeescript
First Look at Coffeescript:(click the picture to see a larger image.) hereinafter)
It has a total of 8 major categories of 68 concepts.
Note: I also think of meta-programming as a concept because it is largely based on the idea of an executable class body (executable class body).
Ruby
Ruby is clearly more complex, with a total of 11 major categories and 96 concepts. It has more complex class models than coffeescript, such as constants, blocks, operator overloads, and so on.
C++
Finally, let's look at C + +:
A total of 18 categories, 186 concepts, almost twice times Ruby, Coffeescript 3 times times!
Some concepts in C + +, such as named parsing, are more complex because of the many subtle rules. And because there are so many different categories, the concept of name in C + + is more complex than other languages. In contrast, in a dynamic language, almost everything is a constant or variable (including the class name and function name).
Also, I deliberately ignored "compile" and "link", because Coffeescript and Ruby do not have these features.
As you can see, there are a number of reasons for C + + complexity, one of which is the static type system, and the other is the template and the name system and the complex class model (complex Class model). The underlying drive must be performance and type-safe.
What information is missing?
I don't mention how many tricks programmers need to master in practice, such as:
Standard class library (libraries)
Programming language idioms and best practices (language idioms and good practices)
Concurrency Concepts (concurrency Concepts)
design mode (patterns)
This is more pronounced when it comes from getting started to mastering.
I believe that C + + is also the most complex at this point. such as "C + + Coding standards" such as the book: "101 Rules", "Guidelines" and "Best practices" and "effective C + +" and so on. Although these books have covered a lot of content, they are designed to solve everyday problems and do not take into account complex use. C + + is definitely more profound than what these books say!
Similarly, other programming languages have best practices and idioms to learn, but I think most languages will be much less than C + +.
What's the point?
I'm not complaining about how big and complex C + + really is. For large projects with significant hardware and performance constraints, there are no other languages that can replace C + +, taking into account the tools, libraries, and developer factors.
However, it is important to note which of the C + + programming must be understood, because it deeply affects the course teaching and the choice of the language of the project.
C + + is not an easy-to-get-started programming language, but learning the language can be time-consuming and time-consuming to master. Therefore, "top-down" to learn C + + is very meaningful!
With the introduction of the C++11 standard, the introduction of the modern advanced subset of C + + (and its standard library) has become relatively easy, and you only need to gradually understand its complex and low-level features. In other words, learning std::shared_ptr should precede the bare pointer, lambda before the functor, Std::array before the C-like array.
If you want to use C + + to develop new projects, the developer experience level and the rest of the time to consolidate C + + capabilities need to be considered.
This is also important: because of the complexity of C + +, the developer language knowledge experience may be very different, so in the interview and training to pay great attention to this! A strong and weak developer will not be comfortable when there is a clear gap between team members.
Finally, there is a 3-language close-up comparison chart:
[Coffeescript] plots the complexity of C + +, Coffeescript, and Ruby