Effective Modern C++

Author: Scott Meyers 
Publisher: O'Reilly 
ISBN: 978-1491903995
Audience: Expert C++ programmers
Rating: 4
Reviewer: Mike James

Effective modern C++, who wouldn't want to write that?

C++ has moved on since its beginnings. The subtitle of this book "42 Specific Ways to Improve Your Use of C++11 and C++14" gives you the clue as to what it is about. It mainly tackles small new features in the language that have a potential to be misused or misunderstood rather than any big philosophical approaches to the best use of C++. 

Chapter 1 starts off looking at type deduction. If you don't know about this topic then you stand a good chance of being confused by this introduction. It is essentially a matter of pattern matching but with some additional rules. Rather then taking a strict approach to defining what the rules are they are introduced by example. At the end you will have a reasonable idea how things work but not necessarily why they need to work that way. It would be better if not only the problem being solved was motivated but the exact solution selected as well. Some examples of how the implementation of type deduction saves us from problems would help. 

Chapter 2 moves on to consider auto and its type inference rules. It is at this point that you really start to think that perhaps C++ is a language with too many flaws that have been patched up in ad-hoc ways. There seem to be so many ways you can misunderstand or get things wrong and. despite the book putting you right. you slowly get the feeling that there are just too many potholes waiting to swallow you up beyond the ones you have avoided. 

Chapter 3 is a long look at topics that might cause you problems in moving to "modern" C++. These are presented as "prefer x to y" with a list of "using y might get you into trouble but using x less so". It starts off with a look at the "tension" between using () and {} to initialize an object. You may know about the mess that is C++ initialization, but to have it displayed and detailed in this way is deeply unsettling. There are some less murky and easier to appreciate suggestions as well. For example, prefer scoped enums to unscoped enums - basically to avoid name collisions - and use noexcept on functions that don't emit exceptions. It might have been better to start the book with these simpler ideas to engage the reader before the really tough stuff got underway.



Chapter 4 is about smart pointers, a topic that could occupy pages and pages in old-fashioned C++ and clearly hasn't gone away in modern C++. Chapter 5 is about move semantics and perfect forwarding, which is one of the biggest changes in modern C++ and then we have a chapter on lambda expressions, another "easier" topic. However, the approach to lambdas doesn't really motivate the basic idea - it just jumps in with both feet explaining how it works and how it can go wrong. As with the rest of the book this is all fine if your basic grasp of the idea is strong enough. The book closes with a chapter on the concurrency API, which isn't a core language feature but is important; and tweaks - two tips that didn't really fit anywhere else.  

This isn't a beginner-friendly book. It launches into its discussions as if the reader was a fellow C++ expert wanting to chat about each topic. It is written in a conversational style and this is good, but occasionally you wish that a more formal definition was included just to clear up edge cases and make certain you had got the idea.

The overall "experts together" approach of the book does give it an advantage in that it is difficult to reject its ideas without appearing to be a non-expert. I don't know that this is the best way to present the material that this book covers, but if you are not a committed C++ user it does have the effect of making you feel that you chose the wrong language. Surely modern C++ is better than this?

For C++ experts this is a must read book - everyone else keep away. 

If you are looking for a book to get you started with C++ my recommendation would be Bjarne Strostrup's Programming: Principles and Practice Using C++ (2e) which is a well conceived and well written introduction both the latest versions of C++ and to programming in general. 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.



Go Programming Language For Dummies

Author: Wei-Meng Lee
Publisher: For Dummies
Date: April 2021
Pages: 336
ISBN: 978-1119786191
Print: 1119786193
Kindle: B0921HHN48
Audience: People wanting to learn Go
Rating: 4
Reviewer: Mike James
Can a dummy master Go?

Web Design, 7e (In Easy Steps)

Author: Sean McManus
Publisher: Easy Steps, 7th Ed, 2023
Pages: 228
ISBN: 978-1840789850
Print: 1840789859
Kindle: B0C24YV788
Rating: 4
Reviewed by: Sue Gee
Web design without a designer - is it possible?

More Reviews



Last Updated ( Friday, 06 May 2016 )