With the introduction of C + + 11 and C + +, many people have rekindled their interest in the language. Many developers, especially Windows developers, would like to know if C # and Java should be discarded, in favor of C + +. John Sonmez doesn't think it's necessary.
In the article "why C + + does not have a ' return of the King ' (Why C + + isn't ' back ')", John Sonmez believes that C + + is only used for the following three reasons:
You need to squeeze every inch of the software's potential performance and want to implement it in a language that supports object-oriented abstraction.
Write code that directly faces the hardware. (for example, write the underlying driver.) )
Memory control and timing are extremely important, so the behavior of the system must be completely determined, and it must be able to manage memory manually. (Think about the embedded real-time operating system that controls the moving parts of the machine.) )
Herb Sutter Highly praised the article, that the text of the "point of view some depth, no exaggeration." On the C + + application scenario, he added:
Service, depending on the runtime is more difficult.
Tests to compare all or most static-linked applications with applications that are compiled or just-in-time (JIT) when they are often first executed on end user machines, which cannot be fully tested.
John Sonmez Against learning C + +, too complicated is one of the reasons. Even though C + + 11 makes development easier, programmers still have to learn a variety of old-fashioned C + + coding methods. "You'll run into the C + + code 20 years ago and look like a completely different language." "To reinforce his point of view, he raised 36 questions for developers who are preparing to apply for C + + jobs. Here are a few:
1. How many initialization methods are there for basic data types in C + +? Can you say it all?
12. What is a copy constructor and when will it be used? Especially compared to assignment operators, can you distinguish between them?
16. When is it appropriate to return a value by reference in C + +?
33. Why should you never throw an exception in a destructor?
Another reason to oppose C + + is that what the programming language really needs is to simplify and improve the level of abstraction, not the other direction. He continued,
There is always a need to write the underlying code, but most of the code we write today is higher-level.
Many years ago, when I finally can not insist that I use C + + development application faster than C #, I jumped off the C + + this ship.
I persisted for a long while trying to convince myself that all my investment in C + + had not been wasted, but it turned out that C # was so much simpler that the extra power provided by C + + was not worth the extra effort.
At the end of the article, John Sonmez said that learning C + + is still useful for understanding the general workings of the computer, "but I don't think C + + will be a comeback, that's a good thing".
In this connection, Alo added:
I started with C + +, and I spent the first four years of my career in C + +. This experience is of great value to me, as your article points out, because once you have learned C + + enough, you can pick up any other language quickly, and you can also get a deeper understanding of how software works at a lower level-if you start learning programming from a higher level of language, It is much more difficult to acquire this knowledge. That's why I've always disapproved of letting programmers start learning from Java.
Richard Dunks retorted to:
I think that in the first semester of the introduction of programming courses and data structure teaching, C + + is not helpful, because the light implementation will take a lot of time, but let the students ignore the structure they want to reproduce. I'm glad I'm proficient in C + +, but I don't think it's worth it, and C + + is definitely not a universal teaching language.
Stephen Cleary has a comment about reusability:
I used to be a C + + developer, and a few years ago, the pressure of the market made me a C # developer. C # is certainly more productive, but it's completely impossible to achieve the level of code reuse of C + + templates.
The classic example is the container, the iterator, and the algorithm. These three carriages. In C + +, you can create an algorithm for any container, and you can adjust the algorithm at compile time to take advantage of the random access capability if necessary. You can try it in C #. This is still not the case with "new C + +"; the 1998 C + + support for code reuse is better than today's C #.
With regard to performance, Herb Sutter gives the following recommendations:
In any language, if you are very concerned about performance, you will use the array in large quantities (not always, just "a lot"). But it's easy in some languages to control the general memory layout well, in particular, control arrays, which are more difficult in other languages or environments (which may make you use them, but more difficult), if these languages or runtime prefer data structures that are constructed by pointers, you will have to "give up" or "try to avoid".
In addition to a great deal of quality commentary on the blogs of Herb Sutter and John Sonmez, Reddit's programming and coding subgroups also have a lot to learn.
Reference English Original: Should developers Start Learning C + +?
Article Source: Bole Online