Effective and More Effective C++ (Books)

On recommendation from a good friend, I picked up two books on C++ programming from the book depository (via Ebay).  "Effective C++ Third Edition" and "More Effective C++".

Although not very recently published books, they remain very, well, effective at teaching good C++ programming habitsThey are aimed at people who have a solid understanding of the language, but may not have the experience to help them choose the most appropriate design for a piece of code, or safeguard themselves from falling into one of the innumerable pitfalls that the language is littered with.  I haven't read the twin tomes from cover to cover yet, but I've technically been programming in C++ for nearly 6 years, and still I managed to pick up something new in the majority of chapters I've read, with the remainder nearly all describing something I already employed, but didn't really know why.

All the basics of design are covered, such as designing interfaces which are easy to use and hard to misuse, resource management, and the books do very well at covering the most prevalent ways in which one can misuse C++ (or which there are no shortage, being C++), but more importantly, they teach how to avoid them.

The language (Prose, that is) used is clear, but quite casual making for a comparatively captivating read (as captivating as a text on C++ can be, at least).  Here is an example I found amusing:

An assignment to self occurs when an object is assigned to itself:

class Widget {...};
Widget w;
w = w;  // assignment to self

This looks silly, but it's legal, so rest assured that clients will do it.

As an example of how thorough the texts are, near the end of "Effective c++" is a chapter titled "Be aware of template metaprogramming".  Note how present the topic as a hazard (which is a very apt way to frame it, I might add) rather than a tool -- helpful or otherwise.  Template metaprogramming is an ingeniously (and I mean "ingenious" in the most insane way possible) abstruse method for forcing code to be evaluated at compile time, which would otherwise have to be evaluated at run time.  This paragraph from the book I think sums it up better that I can:

If you think this is cooler than ice cream, you've got the makings of a template metaprogrammer.  If the templates and specializations and recursive instantiations and enum hacks and the need to type things like Factorial<n-1>::value make your skin crawl, well, your a pretty normal C++ programmer.

I would recommend these books to any C++ programmer -- both new and seasoned -- who has at least basic knowledge of the language.  If you need to choose one book or the other, I would recommend "Effective C++" over it's counter-part, as it covers a much broader range of topics.

Publisher: Addison-Weasly

Author: Scott Meyers


Effective C++ third edition: 0-321-33487-6

More Effective C++: 0-201-63371-x