Slashdot Mirror


Effective C++, Third Edition

nellardo writes "If you've been programming C++ for any length of time, you probably have the book, Effective C++, by Scott Meyers on your shelves. Well, this book has just hit its third edition, and it's a major re-write and re-org. Do you need this book? If you program C++, yes, you probably do, even if you have a previous edition. Don't let the "Third Edition" faze you, because it has lots of new insights into the vagaries of the C++ language. And if you're new to C++, this is pretty much a must-own book." Read on for the rest of Nellardo's review. Effective C++, Third Edition author Scott Meyers pages 297 publisher Addison Wesley rating 9/10 for C++ programmers; not worth it otherwise reviewer nellardo ISBN 0321334876 summary Re-write of standard second book on C++

C++ is a large and complex language, and always has been. That's what made the first edition of Effective C++ so useful. What began as a simple concept of "C with Classes" grew as time went by, developing quirks and foibles that made sense only once you understood a great deal about what was going on. The first edition provided short, digestible synopses of the best practices of quality C++ programming. Even people that had been programming C++ for years could read the book and pick up something new.

That was 1991. A lot has changed in C++ since then. For instance, templates were only just being developed as an addition to the language, and most C++ compilers simply generated C code. Now, in 2005, C++ has gotten a great deal more complicated, and C++ templates have turned out to be a programming language in their own right. Exceptions, the Standard Template Library, threading libraries, and a wealth of truly inventive programming have turned C++ into an amalgam of concepts and mechanisms from essentially every programming language under the sun (ahem). C++ isn't quite as complex as Ada, but that's a much tougher case to make today than in 1992.

In addition, the understanding of what the best practices actually were has changed. Indeed, common tricks from 1991 are now generally frowned upon. In 1991, a friend function was common in code examples. For instance, operators were routinely declared as friend functions. Now, in 2005, friend is seen as creating the tightest coupling possible between components, and is often avoided. What happened?

This is where the book's background starts to shine. Item 1 is "View C++ as a federation of languages." Meyers does a clear and cogent job of decoding broad swathes of C++, explaining C++ as a multi-paradigm tool, and placing language features in different paradigms. Change paradigms and the guideline for what makes for effective C++ changes. This is a hard case to make, but he manages to do it in accessible language even a newbie to the language should be able to follow. Experience from 1991, 1997 (the second edition, mostly a spruce-up job of the first), and now add up to explain the boundaries.

Like earlier versions of the book, the final items provide a good hint on how to keep current. Item 54 is "Familiarize yourself with the standard library, including TR1", and Item 55 (the last) is "Familiarize yourself with Boost." Both of these point to the two places C++ is most likely to grow in the near future, TR1 being essentially done, and Boost being an active source of new things likely to make it into future language extensions.

While 55 items isn't as neat as 50 items, the items in the middle still provide a good place to start for a new C++ programmer. The experienced C++ programmer (the kind who's running around their department suggesting simply using Sutter and Alexandrescu's C++ Coding Standards as the department's new coding standards as is) may not get as much from the book, but it isn't really looking for that programmer. It is advertised as a "second book" on C++, and that's exactly what it is. Buy your textbook to learn from, then buy this book.

Can the experienced C++ programmer get something from the book? Sure, but it's more along the lines of having a handy way to explain to the new guy in the next cube why you want to make sure exceptions never leave a destructor (Item 8) rather than having to figure out a clear way to say it yourself. If nothing else, the more experienced programmer may want to read it just to know what the new guy is likely to ask about.

As a book per se, it's nicely done. It uses color judiciously, mainly to point out the most important parts of the code examples. It also includes lists of items from More Effective C++ and Effective STL, which are handy, albeit blatant plugs. More interestingly, it includes a map from the items in the first edition and the second edition to the items in the third edition (in both directions). This makes it clear that this book truly is a substantial re-write. I would have liked to see a list of all the items, along with the two or three bullets that summarize them as a separate table (maybe on the front inside cover for easy access), but that's a minor point.

All in all, Effective C++, Third Edition is exactly what it claims to be. A significant re-write of the best second book out there. Learning C++? Then pick it up. Using C++ actively with a bunch of other programmers? Pick it up. Not using C++? Don't bother.

You can purchase Effective C++, Third Edition from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

7 of 296 comments (clear)

  1. Object-oriented design patterns. A necessity! by CyricZ · · Score: 4, Insightful

    One of the strong points is its discussion of object-oriented design patterns. These days OO design patterns are just as essential as iteration when programming in languages like C++. But unfortunately, many C++ books fail to mention such patterns, and how they can be used to help make software development quicker, more efficient, and more resistant to errors.

    --
    Cyric Zndovzny at your service.
  2. Finally some great info in a review by Anonymous Coward · · Score: 4, Funny

    Just from reading the front page, I've learned that Effective C++ may be more useful to C++ programmers than those of other languages AND that the "Third Edition" may contain new insights not found in the previous editions. Slashdot needs more reviews like this.

  3. Re:I only have one book on programming by Paralizer · · Score: 4, Informative

    Great book, I have it too. It's perfect for reference if you're having one of those horrid brain cramps, but it is nothing to learn from IMO. If you're just starting out grab another book, the one the story is talking about looks interesting. I'm not much on C++, but it looks great for those of you who really want to get a foothold on the language. Of course, even if you know C++ it's always helpful to try out pure C too.

    The book the parent is talking about is here http://www.amazon.com/exec/obidos/tg/detail/-/0131 103628/qid=1118258760/sr=8-1/ref=pd_csp_1/102-7661 598-1944930?v=glance&s=books&n=507846, C Programming Language (2nd Edition) by Brian W. Kernighan and Dennis Ritchie, the guys who created the language.

  4. Comprehensive List of Book Reviews by turgid · · Score: 4, Informative
    A wise and learned former colleague pointed me at the Association of C and C++ Users book reviews when I asked about getting a modern C++ book.

    Don't let the name of the Association mislead you, they deal with many other programming languages and subjects too.

  5. Re:A Good Book For The C++ Newbie? by SnowDog_2112 · · Score: 5, Informative

    I haven't done C++ programming for almost 5 years, but for five years before that I was developing exclusively in C++.

    Effective C++ (an earlier edition, obviously) was a huge boost to my early years in the workplace.

    It was pretty much required for every new hire to pick it up, our coding standards referred to it, and you were expected to have it nearby if you were messing around with the codebase.

    It is full of no-nonsense vital explanations of C++ best practices. If you're going to break a rule from this book, you should be able to explain why you're going to do it :).

    I still have it in my bookshelf "just in case" I ever am faced with a C++ question.

    Is it a good book for a newbie? I don't know. But it'll help you understand how not to make newbie mistakes, that's for sure.

    If all you're writing are toy programs, heck, it still might be interesting as just good background knowledge. But if you're developing professional software, it will help you make your software more solid and more maintainable.

    And no, I don't know the author or anything. I just loved this book.

    --
    Not representing or approved by my company or anybody else.
  6. Re:A Good Book For The C++ Newbie? by Brandybuck · · Score: 4, Insightful

    Dump the VC++ book. It's not about C++, it's about an IDE and API.

    p.s. If you want an API book, buy "GUI Programming with Qt" instead. It comes with a free copy of Qt noncommercial for Windows. Your programs will be crossplatform and trivially portable to Linux, Unix and OSX. The quality of the Qt API makes MFC drop to its knees in humble supplication.

    p.p.s. If you want to learn the VC++ IDE, read the help pages.

    --
    Don't blame me, I didn't vote for either of them!
  7. Re:I only have one book on programming by Just+Some+Guy · · Score: 4, Insightful
    That's a shame. See (pun), no matter how much you like it, and no matter how 1337 it makes you, there is much more to programming than ANSI C.

    Do you know any functional languages? Can you (intelligently) debate Perl vs. Python? Do you know why Fortran can be much faster than C? Do you believe that a virtual machine can be faster than assembler? If you said "no" to any of those, yet refuse to look past your C knowledge, then you're depriving yourself of a lot of good learning.

    There's a vast difference between "I haven't gotten around to it yet" and "I've already solidified my way of thought". You seem to take pride in the latter, and for that I feel sorry for you.

    --
    Dewey, what part of this looks like authorities should be involved?