Some time ago wrote a how to learn C language, someone replied to ask me how to learn C + +, so I put my personal learning experience here, I hope it is useful to everyone. First of all, because of how to learn the C language in the algorithm and system, so this is only about the C + + language.
- C + + is the hardest language . The most difficult programming language in the world may be a non-C + + mo. You must not think that a few days can learn c++,c++ learning curve is quite bt, you can read this article. C + + is a very free language, free to a bit of BT and terror to the point. I even think C + + is not a mature programming language, because it's too easy to make mistakes. Therefore, you must be very cautious at the beginning, and the C + + as a difficult to train the beast to see .
- ask "Why do you want to do this" question . Learn C + + must ask a few more "why is this", "with what to do" problem. For example: Many people know that C + + has copy constructors and initialization lists, but do you really know why you have copy constructors? Why do you want to have a list of initializations? Why should there be a template, why should have rtti, why not other? Is it just to make a language cool? Not at all, any of the feature in C + + has some real reasons, you have to understand why you should design C + + for such reasons, you can learn C + +. Take a look at the book "C + + evolution and Design".
- read a book, a large number of C + + books . You can read in the following order (these books, I spent about 4-5 years, today I still review)
- C + + Primer, this primer may make you eat very painful, all the characteristics of the language and why are in it, read well. Of course, the C + + 's father wrote "C + + programming language" is also good. It would be nice to read one of the two books (I see the former).
- Understanding C + + syntax is just the first step of Long March, you need to look at "effective C + +" and "more effective C + +" These two books are not thick, but I have seen from 02 now, every time I read a new experience, these two books are too classic. If you are not familiar with C language, these two books would let you go back to the C language class.
- Think in C + + is another classic extreme book, learn C + + must read, but the Chinese version of the translation is very bad, so read the English version of it. The
- Meditation on C + + is also well worth reading, which teaches not programming, but the method of thinking, which is quite precious.
- Exceptional C + + and more exceptional C + + give you a look at the solutions to various problems and some common classic mistakes.
- Advanced C + + and modern C + + allow you to know the various magical uses of C + +.
- generics programming and STL are the things that put C + + in practice to the extreme. Very powerful. stl--Template Libraries (containers, algorithms, and function objects) are not to be obeyed.
- Exploring the C + + object model in depth gives you an idea of what C + + is like under the compiler, so you know that C + + performance is not bad. This is too critical for a C + + programmer. I have written before the "C + + virtual function table parsing" and "C + + Object memory Layout" belongs to this category.
- In contrast to the Java language . I personally think that Java has made a lot of adjustments, specifications and limitations to the immature language of C + +. So, in contrast to Java and C + +, think about why some things can be done in C + +, but not in Java. For example: Java exceptions are required to catch, otherwise it will be compiled do not pass. Why doesn't Java provide operator overloading? Why does Java introduce interfaces to do multiple inheritance? Why doesn't Java have a stream of I/O characters like C + +? Why does Java not support pointers? Why Java can be garbage collected? Wait a minute. Java embodies a lot of object-oriented design, learning Java can help you learn how to better use C + + to program .
- Object-oriented design . While object-oriented may be a scam. But I think some of the practices in object-oriented design are very good, such as the single principle, the dependency inversion principle, and so on, are very classic. "Design mode" must be read, "Object-oriented analysis and design" can be read. but it is not possible to design patterns for the center of programming, but should be used in design mode to solve the lotus root .
- Class Library Learning . See how MFC encapsulates the Windows API, see how Aces are object-oriented, see how boost plays object-oriented, and see how cppunit is designed. Of course, there are too many design patterns in Java's JDK to refer to.
I hope not to scare everyone, and welcome you to add.
————— Update 2011/03/30 19:20 ————
Update several ideas:
- 1) I am not good at writing reviews, so the recommended books may make you feel a little bit, you can read the book reviews on the watercress or china-pub.
- 2 C + + has a lot of kinky tricks, some very bt, including virtual function table, perhaps some people feel a little boring, but I think it is very interesting, on the one hand can understand the implementation of a language details, on the other hand can broaden the thinking. I have benefited a lot from learning this knowledge.
- 3) The above is my personal learning process, I think it is very effective for me, so is the experience.
- 4) This kind of article on the internet has a lot of, I am not the first to write such an article, I do not write the best, I do not want to use a lengthy talk about what. Just want to give you a look at the general study. After all, C + + is profound, no article can say well. It's easier than that.
This article transferred from: http://coolshell.cn/articles/4119.html
How to learn the C + + language