More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions
Aimed at advanced C++ developers who want to hone their programming chops even further, Herb Sutter's More Exceptional C++ borrows the format of his earlier title, Exceptional C++, and delivers some of today's best available thinking on the language in a handy and effective format. A compilation of the author's own experience and research on the thornier aspects of C++, this book will serve as a worthy resource for making sure you get the most out of this powerful language.
|von Herb Sutter|
The concise text covers a range of challenging topics in C++ without attempting to be comprehensive. Each "item" is presented as a question for you to try and solve by yourself before the author presents his solution, plus additional detail as needed. For most topics, Sutter ends by giving his advice on the best practices (and gotcha's to avoid).
Early sections concentrate on using Standard Template Library (STL) container classes, such as removing items effectively, and the subtle differences between container types. Standout sections on designing custom templates (using specialisation techniques) and designing exception-safe classes will help you do more with your own classes. One entertaining problem here shows a number-guessing game (Mastermind) built as efficiently as possible using STL code (including expert-level use of generic functions to do much of the work).
Several problems on copy-on-write (COW) semantics for more efficient classes point out the issues surrounding code optimisation. (The author argues against a simplistic approach to optimising code, including an over-reliance on inlining functions. Several times, he points out the difficulty of getting COW code to work in multi-threaded projects.)
There has been a debate in the C++ community for years on whether it's possible to design truly "exception-safe" classes. Sutter points out the difficulty with a precise analysis of the issues surrounding exceptions and C++ constructors. Material on the finer points of inheriting classes (including when to avoid and when to use multiple inheritance in C++) will extend your class design options. A good section here is the author's explication of how to simulate COM/Java style interfaces in C++, which isn't immediately obvious, even to experienced C++ developers.
Later sections delve into code-maintenance issues, including advice for using macros, typedefs and namespaces. (Advice on migrating existing C++ code into namespaces will help you combine legacy code with other libraries.) A final appendix shows off some benchmarks for optimising strings using a variety of techniques.
Intelligent, provocative and demanding, More Exceptional C++ shows off why C++ continues to be a rich, complex and challenging language. Armed with titles such as this one, experienced C++ programmers can write better code and avoid pitfalls buried in the outer edges of their favourite language. --Richard Dragan
Great book for experienced c++ coders
First, this book contains excellent analysis and detailed information, some of which I have not found in any other book yet. Even experienced c++ programmers will get new insight while working through the exercises, for example on exception-safe template design, or on namespaces. The part on copy-on-write in single-threaded and multithreaded environments alone makes this book worth buying.
Second, be warned, there is some really advanced stuff. The book is organized in question and answer form. If you want to
find the answers for yourself, you will almost certainly need a copy of the language standard, and a lot of time.
The authors style is sometimes tense, still this is one of the most entertaining technical texts I have read so far.
One the downside, the book is not really self-contained. At the very least, you should have worked through the first volume, "Exceptional C++", before you start with this one. The author takes a lot of concepts and terminology from its
predecessor for granted. Also, a basic knowledege of design patterns is very helpfull.
I was tempted to rate this book at five stars because the content is really excellent. But it is more a collection of
interesting topics than a comprehensive survey, and I see some room for improvement in its organisation. Anyway, this is a great book, well worth its prize.
| > More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions|