C++ is a large language widely used in industrial software development. Its own complexity and ability to solve real-life problems make it of great academic research value and industrial value. Like the C language, C++ has been very successful in many important areas.
# However, an undeniable reality is that in the field of low-level programming, C++ is squeezing C and is also suffering from the strong rebound of C. In the field of high-level programming, Java and C# are constantly encroaching on C++'s territory. Maybe the integration of C++ and C will always be a dream. Maybe the craze of Java and C# will eventually force C++ to return to its roots - back to the development areas where it has fundamental advantages: low-level system programming, advanced large-scale high-performance application design, Embedded programming and numerical scientific computing, etc. If so, I think this is not a bad thing.
#C++ has attracted so much intellectual investment that there are countless excellent works in this field, including heavyweight software products, libraries, and books. A less strict meaning of the title "Four Books and Five Classics of C++ Programming" is: Four Books of C++ Programming ⅹ Five Classics. Yes, in this article (and the next one), I will recommend more than 20 good C++ books by category, and you can choose to read according to your own needs.
##TCPL and D&E are "The C++ Programming Language" and "The Design and Evolution" respectively of C++", both written by Bjarne Stroustrup. I list them separately, first because Bjarne is the creator of the C++ language, and secondly because of a more important reason than "first": these two books are unquestionable masterpieces in the field of C++. It is not an exaggeration to say that they are the C++ language bible.
Bjarne Stroustrup, The C++ Programming Language (Special 3rd Edition)
## )", Machinery Industry Press
"C++ Programming Language (Special Edition) (English Photocopy Edition)", Higher Education Press
To date, TCPL is the most authoritative C++ reference manual besides the C++ standard documents. Unlike most people's opinions, I think Bjarne's written language is not inferior to the programming language he created. At least I like this kind of academic work. This book's description of the C++ language is clear-cut and straightforward. It looks at C++ from the perspective of the language's creator, which no other author or book can do - no one knows how to use C++ better than Bjarne himself.
This is a serious book, targeting intermediate and advanced C++ developers. If you are an experienced C++ programmer and need to understand more essential C++ knowledge, this book is just for you. It is not the kind of little book that makes you chuckle after reading it. It needs to be understood carefully and chewed over and over again. During the reading process, please pay special attention to what Mr. Bjarne emphasized and what he mentioned in one sentence. I personally like the fourth part of this book "Designing with C++". It is difficult to see such content in similar programming language books - I even think that Bjarne should write this part as a separate book.
Bjarne Stroustrup, The Design and Evolution of C++
"The Design and Evolution of C++ Language", Machinery Industry Publisher
Unlike most C++ tutorials on the market, this book does not start with "C in C++", but starts with authentic C++ features. From the beginning, the standard library is used to write programs. As the description gradually deepens, the basic concepts on which these standard library components depend are explained one by one. In addition, unlike other C++ textbooks, this book uses examples to explain the language and standard library. The latter two are explained to provide support for example programs, rather than just using examples like most C++ textbooks. An auxiliary tool for demonstrating language features and standard library usage.
The author is world-class in programming practice, education and training, and technical writing in the C++ field. I like this refreshing writing style that makes heavy use of the standard library and native features of the C++ language. In front of this textbook, almost all C++ textbooks to date eclipse or appear outdated. Although this textbook may be a bit avant-garde for domestic higher education, I still highly recommend it to my colleagues. By the way, in a recent correspondence between Bjarne and me, he commented on this book: For experienced programmers learning C++, this book may be the best book in the world.
Stanley B.Lippman, Josee Lajoie, C++ Primer (3rd Edition)
This program has been running very well, but one day after leaving the site, the system administrator called and said that sometimes the gateway program would crash due to network failure or other reasons - it would just crash on its own. , the problem is that it will also turn Windows 2000 Advanced Server into a "blue screen"! Frankly, I've never seen an unintentional program do this. Because I was busy with another big project at the time, I was unable to go to the site for debugging. In the end, I had to carefully encapsulate the memory library code with exception handling code based on experience (and also made some other modifications...). In this way, although the problem is not completely solved, the program is no longer so ugly after all.
What’s the point of telling such a tidbit here (I didn’t think it was a “tap” when I was thinking about that terrible bug)? What I want to say is that for any software, there is no efficiency without robustness. For C++ programmers, it may not be difficult to write an efficient program, but it is not so easy to write a server-side software that needs to run 24/7. Many factors need to be considered, and sometimes these factors are even far away. Beyond the C++ language and development tools themselves. As a programmer who develops actual project software, we don't have to hit the wall ourselves to accumulate experience. As long as we are modest enough, other people's experiences are often a good reference for us. For this reason, I recommend the following books for you to read, which can benefit you from both robustness and efficiency (of course, they cover much more than exception handling).
Scott Meyers, Effective C++: 50 Specific Ways to Improve Your Programs and Design (2nd Edition)
Scott Meyers, More Effective C++: 35 New Ways to Improve Your Programs and Designs
《Effective C++ Chinese Edition》, Huazhong University of Science and Technology Press
"More Effective C++ Chinese Edition", China Electric Power Publishing House
"Effective C++ (photocopy version)", China Electric Power Publishing House
If "Effective C++" mainly discusses some relatively basic concepts and techniques in C++, then "More Effective C++" focuses on a series of advanced concepts including exception handling. technology. Compared with the former, the latter has two main differences: first, it contains a lot of new standard C++ content; second, the topics it discusses tend to be "strategic" rather than "tactical", and the discussions are Deeper and more thorough. In particular, the in-depth discussion of technologies and patterns such as virtual destructors, smart pointers, reference counting, and proxy classes is hard to imagine appearing in such a small book.
With his technical skills and superb writing skills, Scott is undoubtedly one of the best C++ technical writers in the world. Both books are outstanding in terms of simplicity, clarity, and readability. In short, the 85 methods provided by Scott to improve programming skills and design thinking are all essential skills for intermediate and advanced C++ programmers. I highly recommend both of these books (there’s actually one more, as you’ll see later).
Herb Sutter, Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions
Herb Sutter, More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions
"Exceptional C++ Chinese Edition", China Electric Power Press
"More Exceptional C++ Chinese Edition", Huazhong University of Science and Technology Press
Do you consider yourself a C++ language expert? Read these two books by the Secretary General of the ISO C++ Standards Committee before answering. In these two books, Herb uses a "question and answer" approach to guide you in learning C++ language features. For each topic, Herb first reasonably imagines your questions and confusions, then guesses that your answers are probably wrong, then gives you guidance and proposes the best solutions, and finally summarizes solutions to similar problems. principle of universality.
These two books are typical works that delve into the details of the C++ language. They are very thin, but the content is dense, far exceeding Scott's two books, and it is very time-consuming to read. Brains - I personally find them much more difficult to understand than Scott's books. It would take at least several months to study the knowledge contained in these two slim books! (In Scott's preface, he confessed that he fell into the trap of GotW problems more than once. You should know what this means) What are the benefits of studying the details of the language? Although in most cases we don't have to care about what's going on behind the scenes in C++ code, when we do, these two books can provide us with good clues because they reveal the subtle yet crucial aspects of the C++ language. s things.
Stephen C. Dewhurst, C++ Gotchas: Avoiding Common Problems in Coding and Design
《C++ Programming Traps 》, China Youth Publishing House
Stephen’s theoretical literacy and practical experience make this a good book worth reading. Stephen was one of the first C++ users at Bell Labs. He has successfully used C++ to solve problems in areas including compilers, securities trading, e-commerce, and embedded systems. This book brings together the author's 99 programming insights from the front line of development. By understanding them, you can avoid almost all common C++ design and programming problems.
I even think that for C++ programming novices, reading this book will make them easier and more immediate than reading Scott and Herb's book. . I personally like the writing style of this book - many of Stephen's views may seem extreme but are irrefutable. Of course, this confidence (and dry humor) comes from the author's profound technical literacy, not arrogant paranoia.
In addition to the books recommended above, "Efficient C++: Performance Programming Techniques" co-authored by Dov Bulka and David Mayhew ("Programming Techniques to Improve C++ Performance", Tsinghua University Publisher) is also worth a look. This slim little book focuses on high-performance C++ application development. The two authors are both IBM software experts and both work in the field of system construction with extremely high performance requirements. This book is based on their experience. Some people don't like this book because it spends a lot of time talking about things that have nothing to do with C++, but I like this book precisely because of this. It is these things that broadened my horizons.
Template and generic programming
Template and template-based generic programming are undoubtedly the most actively developed today C++ programming technology. The first revolutionary application of templates was STL, which fully demonstrated the application of template technology in the fields of generic containers and algorithms. Modern libraries such as Boost and Loki continue to maximize the potential of template technology. In the field of templates and generic programming, I recommend the following two heavyweight books:
David Vandevoorde, Nicolai M. Josuttis, C++ Templates: The Complete Guide
"Overview of C++ Templates (Traditional Chinese version)", Taiwan Cifeng Information Co., Ltd.
##"New Thinking in C++ Design: Generic Programming and Design Patterns Applied" "Application of Type Programming and Design Patterns", Huazhong University of Science and Technology Press
"New C++ Design Thinking (Photocopied Edition)", China Electric Power Press
Do you consider yourself a master of C++ template programming? Please read this book before answering J. This is an awe-inspiring masterpiece written by a genius. Generic mode extends your horizons infinitely and is enough to challenge the thinking limits of any C++ programmer.
This book is divided into two parts. The first part discusses the basic technology used by the Loki library and some high-level language features, including strategy-based class design and templates. Local specialization, compile-time assertions, Typelist, small object allocation techniques, etc. The second part focuses on the important components and generic pattern technology in Loki, including generalization functor, singleton, smart pointer, object factory, and abstract factory. , Visitor and Multimethods, etc. Every technology is eye-opening and breathtaking.
#In terms of learning C++, going too far is often an excuse for not seeking a deeper understanding. However, object-oriented is not all of C++, templates and generic programming also account for half of it. For "serious" C++ programmers, it is a wise move to follow up on this proven successful technology in a timely manner.
Conclusion
These books are so famous that perhaps I don’t need a recommendation at all. However, even if the C++ programmer team does not grow as fast as other more fashionable languages, there are always more new people coming in than old people leaving. In addition to warmly welcoming newcomers, I personally think it's time to take an "inventory" of C++ books, and hope that such an "inventory" will be beneficial to interested readers. Please be patient and gracious. In the next article, I will continue to introduce good C++ books on the standard library, network programming, and other aspects. With a good book by your side, this winter will not be cold.
The Four Books and Five Classics of C++ Programming (Part 2)
I "inventoryed" TCPL in the previous article There are more than a dozen good C++ books on D&E, introductory tutorials, efficient and robust programming, templates and generic programming. Winter is turning to spring, let us continue the wonderful journey of C++ books While working, I worked with two other research institutes in the same hospital to develop a large-scale water conservancy hub dispatching integration project. Our three software systems all need to communicate with each other. When debugging the communication module, an attentive customer (a studious system administrator) found that mine did not exceed 30 lines of interpretation code for the same communication protocol, while the other party's code exceeded 150 lines and was difficult to understand. The system administrator was very puzzled. I said that everyone's programming styles and habits are different. I use the standard library, but he uses the traditional C programming style and other technologies that he is accustomed to.
Do not misunderstand! I in no way mean to disparage this partner. In fact, I often admire programmers who really have deep C programming skills. After all, C++'s success today is largely due to its deep roots in C. As a C++ programmer, if he is not familiar with C in C++, I tend to think that his basic skills are not solid and his technical confidence is insufficient.
But then again, C++ is a multi-paradigm programming language. Professional programmers should know which programming style to use depending on the specific situation. Certainly. As a project leader who often needs to do impromptu development on site, in order to solve urgent tasks quickly and quickly, I am accustomed to using existing libraries (and components) as much as possible. The proven efficiency (and robustness) of the C++ standard library is already there, so why not use it?
Nicolai M. Josuttis, The C++ Standard Library: A Tutorial and Reference
##The C++ standard library consists of three parts: STL, streams and localization. There are already books on STL on the market. There are many, but rare, monographs on streaming and localization. This book is the best of the two fields. No book to date discusses streaming and localization in more comprehensive detail than this one. If you are not satisfied with staying at the level of "being able to use" Liuku, don't miss it
##In the summer of 2001, I read through the Chinese version of this book. Edition, everything from the content to the packaging left a deep impression on me - but mostly negative. In the fall of 2003, I accidentally learned that an online bookstore was selling the Chinese translation of this book at a very low price. I couldn't help but feel excited. Sorry.
## "Effective STL (photocopy version)", China Electric Power Publishing House
#After reading the Chinese translations of Scott's "Effective C++" and "More Effective C++", I have been looking forward to it The Chinese version of this book. I learned from Mr. Pan Aimin’s personal homepage that he and his partners seem to have completed the translation of this book, but it is still not available on the market. Fortunately, we can. See the original version of it
##.
This book is a must-read for programmers who use STL. In this book, Scott tells us how STL containers and algorithms work and how to best use them. Like Scott's other works, this book is written in a clear, precise style and is extremely readable. After reading this book, I think you may have the same thoughts as me and other C++ programmers: When will Scott write a "More Effective STL"?
Regarding STL, I also remind you to pay attention to Matthew H. Austern's "Generic Programming and the STL: Using and Extending the C++ Standard Template Library" ("Generic Programming and the STL") STL", China Electric Power Press). This book exudes a strong academic atmosphere. At the end of the book "Accelerated C++: Practical Programming by Example", Andrew Koenig and Barbara Moo solemnly recommend two other good advanced books (in addition to their own "Ruminations on C++"), one of which is TCPL, and the other is This book!
Network Programming
In the era of network programming, what role should C++ play? Let ACE (Adaptive Communications Environment) to tell you.
Douglas C. Schmidt, Stephen D. Huston, C++ Network Programming, Volume 1: Mastering Complexity with ACE and Patterns
Douglas C. Schmidt, Stephen D. Huston, C++ Network Programming, Volume 2: Systematic Reuse with ACE and Frameworks
《C++ Network Programming, Volume 1: Application ACE and patterns eliminate complexity", Huazhong University of Science and Technology Press
"C++ Network Programming, Volume 2: Systematic reuse based on ACE and frameworks", Electronic Industry Publishing Society
# uses C++ for enterprise-level network programming. Currently, ACE (and these two books) is a choice worth considering. ACE is an object-oriented, cross-platform, open source network programming framework that aims to build high-performance network applications and middleware. Douglas is the founder of ACE, and Stephen has provided technical support and consulting services to ACE for several years. Both of them are members of the ACE community (yes, the impact and practical application of ACE have formed a community) expert.
#ACE is not just sought after by universities and research institutes, it has been successfully used in thousands of commercial applications around the world. ACE has played and continues to play an important role in network systems in the fields of telecommunications, aerospace, medicine and finance. If you're ready to develop a high-performance communications system, you should consider this collection of the world's leading experts.
In addition to using high-level language features such as C++ object-oriented design technology and templates, ACE also uses a large number of patterns. "C++ Network Programming" Volume 1 and Volume 2 not only teach you all aspects of ACE, but also teach you advanced techniques such as patterns and general framework design. Therefore, as an intermediate or advanced C++ programmer, even if you rarely do serious C++ network programming, you can still benefit from reading these two books.
Yes, not all network applications have to use Web servers (and other application servers) and heavyweight component models. To change the way of thinking, they may also use lightweight components. benefit from the ACE component.
Miscellaneous
The following books are included in the "Miscellaneous" unit simply because I don't have them Think of a more appropriate categorization, they are just as worth reading as the books above.
Bruce Eckel, Thinking in C++, Volume 1: Introduction to Standard C++ (2nd Edition)
Bruce Eckel , Thinking in C++, Volume 2: Practical Programming (Second Edition)
"C++ Programming Thinking (2nd Edition) Volume 1: Standard C++ Guide", Machinery Industry Publisher
"C++ Programming Thoughts (English Edition 2nd Edition)", Machinery Industry Press
" The first edition of "Thinking in C++" won the Book Shock Award from Software Development magazine in 1996. The newly launched second edition has significantly rewritten and adjusted the content to reflect the impact of C++ standardization and the latest research and practice results in the object-oriented field in recent years. Advanced topics such as "Input Streams", "Multiple Inheritance", "Exception Handling" and "Runtime Type Recognition" are placed in the second volume, along with some content added after the standardization of C++. Bruce is an experienced C++ lecturer and consultant. His training and writing experience are world-class. His works are more attractive to readers than those written by "playful" technical staff. In fact, among similar books, this book is more readable than TCPL and "C++ Primer" for most readers. By the way, you can get a sneak peek at the second volume by visiting the author's site.
Andrew is one of the few C++ experts in the world. This is a book about C++ programming ideas and programming techniques rather than language details. If you already have a certain foundation, this book will teach you how to think when programming in C++ and how to express solutions. The technical expression of the whole book is thorough and the text is easy to understand. Bjarne commented on this book: This book is full of insights on "what C++ is and what C++ can do."
Stanley B. Lippman, Inside The C++ Object Model
"In-depth exploration of the C++ Object Model", Huazhong Technology University Press
# "In-depth exploration of the C++ object model (photocopy version)", China Electric Power Press
from Observing C++ from the compiler's perspective can help you understand what is happening and why. This book discusses a large number of underlying operating mechanisms of C++ object-oriented programming, including constructors, functions, temporary objects, inheritance, virtualization, instantiation of templates, exception handling, runtime type identification, etc. It also introduces some aspects of implementation. Tradeoffs made in the C++ object model process. C++ programmers who like to dig deeper should not miss this book.
Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Design Patterns: Elements of Reusable Object-Oriented software
"Design Patterns: The Foundation for Reusable Object-Oriented Software", Machinery Industry Press
"Design Patterns: The Foundation for Reusable Object-Oriented Software (English version) )》, Machinery Industry Press
# To design reusable object-oriented software, you need to master design patterns. This book is not written specifically for C++ programmers, but C++ programmers in particular will benefit from its use of C++ (and Smalltalk) as the primary example language. The four authors are all internationally recognized experts in the field of object-oriented software. They have recorded their object-oriented software design experiences in detail as design patterns. The influence of this book was so profound that the four authors and the book were nicknamed GoF (Gang of Four). This book has a strong academic atmosphere and a rigorous and concise writing style. Although it is not as easy to read as some books that explain patterns, if you really want to accurately understand design patterns, this book is the ultimate authority. To learn design patterns, this book needs to be chewed over and over again. By the way: Please turn design patterns into the key to open-minded thinking, and never become the shackles of closed thinking.
There are also some good C++ books worth reading, but I cannot list them all here. For example, John Lakos's book "Large-Scale C++ Software Design" ("Large-scale C++ Programming", China Electric Power Press) and Mr. Hou Jie's "STL Source Code Analysis" (Huazhong University of Science and Technology Press), etc.
"STL Source Code Analysis" is a very distinctive book, but I think it can be better. I personally look forward to Mr. Hou Jie writing a more in-depth, thorough and comprehensive "Second Edition" after he has accumulated and rethought template technology since the release of the first edition. Unfortunately, Mr. Hou Jie seems to have decided to temporarily bid farewell to the fields of templates, generic programming and STL after completing the translation of the book "C++ Templates: The Complete Guide".
Added on March 31, 2004: The two reference books I consult most often are "C++ Standard Program Library" and "STL Source Code Analysis". Of course, this has a lot to do with my writing plan for the year.
Using C++ to successfully develop large-scale software systems requires not only a good understanding of the logical design issues described in most C++ books, but also a mastery of "Large-Scale C++ Programming" "Physical design technology described in ". Of course, this book is a bit outdated, but if you have the energy and money to spare, there's no harm in buying a copy.
At this point, I think it is necessary to state that there are some (good) books that are not recommended, and the main reasons are as follows:
The above books are enough and good enough.
I will not recommend books that are difficult to purchase through normal channels - whether in Chinese or English.
The fame of the author (translator) does not affect my recommendation. We are reading books, not people.
I will not recommend a book that I have never read. I need to have seen at least one version of it (including the electronic version). This "reading" generally means "reading carefully", but some can only be regarded as "browsing".
Conclusion
As an ordinary technical translator, I know very well the hardships of technical creation and translation ( and happiness), and learn more or less about the details behind the creation, translation, production, publishing and marketing of technical books. Today, I will not say anything about a book that seems to be unsatisfactory. The purpose of listing various versions of the same book is only to provide you with more information and give you one more choice.
In the later stages of writing this article, I wrote a letter to Bjarne and asked him what he would write if he were to write this article. He gave me concise advice. While confirming that most of the books listed above are the world's top C++ books, Bjarne reminded me not to forget to recommend "The C++ Standard: Incorporating Technical Corrigendum No. 1" to expert programmers. This book is the "book version" of the C++ standard specification, and Bjarne personally wrote the preface.
#Bjarne also kindly reminded me that there is no book on my recommendation list that will help C++ programmers with Windows programming - which is exactly my intention. In this article, I only recommend and review platform-neutral C++ works (except network programming) - they have nothing to do with the operating system, nothing to do with the integrated development environment, and I even imagine that they have nothing to do with the compiler. You can choose to read C++ books related to your favorite field according to your business development needs.
Speaking of "system-independent and platform-neutral", I can't help but think of the concept of "abstraction layer". C++ programmers who develop practical applications usually work in specific operating systems, specific development environments and specific business fields. A solid and profound grasp of standard C++ and the C++ standard library will undoubtedly enable you to work in different operating systems and different Development environments and the "abstract" costs that flow across different business areas.
The above is the content of the Four Books and Five Classics of C++ Programming. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!