Effective C++ by Scott Meyers has been around for awhile and it is pretty revered. With good reason. It is one of the books a lot of C++ programmers, both beginners and adept, read and then never look back after. After being recommended the book several times, I finally got around to picking it up.
Unlike a lot of other programming books, such as the ones I’ve previously reviewed, this isn’t a tutorial or “how-to” C++ book. So there is some technical requirement for the book and if you don’t have interest in C++, it probably won’t do much for you. But if you want to check it out, my review can be found after the break.
Effective C++ explains and demonstrates 55 “items” that change how you program in C++. From how you view C++ as a language to defining custom new/delete operators, Scott goes through each guideline with precision, relevant detail, and handy examples. His writing is a hoot too. It’s sprinkled with a little satire and surprising relevant side-notes that keeps you in line and paying attention to the writing from start to finish. It’s quite refreshing compared to most technical books where you get large paragraphs of nitty gritty detail that you couldn’t care to remember after you turn the page.
There is a lot of information in this book. Really good, concise information and that’s why its considered a classic. C++ can be a bit of an enigma, I can vouch for that. And every day I learn quite a lot about the language in my work, no matter how seemingly small – it always shows up again a few days later. And that’s what the book really nails. It tries to demystify the enigmatic language, even trying to give rhyme and reason to undefined behavior that most programmers might be completely blown away by because most typical languages don’t really have that. If you don’t know what it is: its logic that can’t really be predicted when the program runs. Literally you can imagine them as black holes that can rip programs apart. I’ve read seemingly silly and impossible stories about whole computers being destroyed because of undefined behavior corrupting RAM, rampant deletion, and peripherals exploding (monitors). Lots of stuff can happen.
That’s what kind of makes the book great. Even for very well-defined behavior, a lot of C++ doesn’t quite function as straightforward as some are brought up to think. I recently wrote about one of them. I found a lot of the inheritance quirkyness sections to be extremely interesting in the book. I was taught “is-a” and “has-a” relationship models in school, but the book does an awesome job of making the models clear and concrete for public, private, and protected (maybe? ha) inheritance. Inheritance sounds very easy to do and for primitive models, it really is. But once you get nuances where “type C is a type A and B but only parts of type D”, OOO can enter some funky territory. A lot of people get taught different ways to handle OOO and its not always clear cut as they’ve been taught, I can attest. Effective C++ helps dispel some of that and offers multiple solutions to advanced inheritance problems that even beginners should be able to follow. And the best part is that I can take what I learned here, especially a lot of the virtual function nuances, and apply them in other languages when designing OOO systems.
One thing I didn’t particularly enjoy too much was the amount of C++ TR1 features in the book. I could be wrong, but I think they were added to the book in a somewhat recent edition. Personally, I don’t have much use of TR1 features because I can’t use them at work. And some of the issue Items are just ‘solve by using auto-pointers’ and similar. Not a huge fan of that. Also, I don’t enjoy the example syntax used with the TR1 stuff. Kind of hard to follow, but I chalk that up to my lack of experience using TR1 stuff and some Boost syntax. I find it to be more of a “you gotta use this more in your down time just to get experience with it” than anything. And I hopefully intend to. But, the majority of the book does not use TR1 so that’s okay.
Another nuance was I found some examples and Items to drag on much longer than expected compared to others I personally might have found more interesting. There is one example, for example, that uses a “widget” and it gets used over and over again for multiple Items. And I found it annoying to keep having to go back and find the implementation of the previous widget functions sometimes. The items that go on for long tended to be some of the TR1 related ones, so I can kind of lump that together.
Customizing new and delete operators was pretty awesome to read about in detail. Particularly because I’m doing a lot of profiling work and I see where great statistics can be gathered now with a custom new, perhaps how memory allocation can be really improved depending on the program & machine use, as well as exception handling. Its fascinating stuff and very few if any other languages commonly used provide this level of…. awesome. Its so ‘mechanical’ in a good way if that makes any sense, and the book really highlights why.
- Incredibly detailed, yet concise
- Every Item has a level of importance with each being considered good to know
- Sprinkled satire makes the reading fun
- Better than any technical textbook I’ve had the ‘pleasure’ of reading, at 1/5 the price
- Fosters great programming habits for other languages too
- TR1 wasn’t super applicable to me and there was quite a bit of it, but it could be for you or come up in the near future for me as well.
- Some examples run on for too long, and can muddle the Item
Who for: Anyone who works with C++ in any capacity