Two Awful Books

So… My blog originally started out as a book review blog, and to celebrate its return (we moved from a home-hosted server to something cloudy), let’s talk about two gosh-darned awful books.

The thing is this: I’ve been so busy with actually maintaining a 600 kloc project that I’ve neglected keeping up with the changes in the language the project uses. Yet C++ has changed a lot, even if our codebase hasn’t. I did buy Stroustrup’s C++11 Programming Language book, but never had time to read it.

And now we’re at C++17. So I thought I’d get a couple of books with C++17 in the title to help me figure out what has changed, why it has changed, how it has changed and what the changes are good for. I got two books from Apress, which is a Springer imprint.

So let’s go for a quick syntax overview. C++17 Quick Syntax Reference. The author, Mikael Olsson, is a Fin, and weirdly enough his bio is smaller than the technical reviewer’s bio, Massimo Nardone. Massimo also gets his picture printed, Mikael doesn’t. Judging from the layout, the book itself is obviously either meant for pre-school children or people with vision problems even worse than mine: the letterpress is enormous. All that would not be a problem, but…

A quick syntax reference has no business explaining how to choose an IDE or how to create a Hello World application. A C++17 syntax reference should also teach modern, 2017-level C++, not 1972 level C. The final chapter, Chapter 27, explains what Headers are, Why Use Headers — with this gem of an observation “C++ requires everything to be declared before it can be used.” Then it goes on the show how to #include a header — heady stuff! After some more kindergarten stuff it finished up explaining include guards.

The book isn’t actually written in broken English, but it is unreadable all the same. Just look at this quote from page 58:

“In addition to passing variables by value, reference, or address, a variable may also be returned in one of these ways. Most commonly, a function returns by value, in which case a copy of the value is returned to the caller.”

Okay, writing this book was a waste of time for the author, unless he’s getting rich from it, which I doubt. It’s a waste of time for the reader, and spending more time on it is going to be a waste of time for both me, and you, my reader. The book will be pulped and recycled.

Next. “Clean C++”: Sustainable Software Development Patterns and Best Practices with C++17″ by Stephan Roth.
Same publisher, same awful print quality, but since Stephan produced a lot of text, the font size is very small. This time the author gets his mugshot printed, and the technical reviewer, Marc Gregoire not. Marc is Belgian, Stephan German and I suspect that the copy editor was Martian. The very first sentence is already broken:

“It is still a sad reality that many software development projects are in bad conditions, and some might even be in a serious crisis.”

The author then continuous riding his hobby horses, even quoting the long-discredited “broken window” theory.

Some things are nice, the author uses actual code samples from actual projects, like Apache OpenOffice, to show problems. Some chapters have promising titles, like “The Basics of Clean C++”, but then start exhorting the reader that “Names Should Be Self-Explanatory”. I thought I was reading a book on clean C++, not Java for high school students? Apparently, removing the license header from your source files will also make your code more Clean!

“Advanced Concepts of Modern C++” is more interesting, though either I am dumb, or the author was in need of a good editor to help him explain what he means, because much of the text I just cannot follow. I would also have liked some clear explanation of why automatic type deduction is good, while at the same time, we’re exhorted to do Type-Rich Programming. The rest of the book rehashes in an an abbreviated way what was explained much better elsewhere: Object Orientation, Functional Programming, Test Driven Development, Design Patterns and UML.

The book promised to show how to use C++17 to write clean code. Instead it regurgitates every bromide from Code Complete and similar books published in the past two decades without adding anything interesting or even talking about C++17 much.

Maybe I’m hypercritical these days… But this book will also be pulped. In any case, any suggestions for something that will teach me to read and write real modern C++17 are very welcome!

4 thoughts on “Two Awful Books”

  1. Scott Meyer’s “Effective Modern C++” is nice. It’s about C++14 and C++11, but then again, you said you haven’t really kept up with C++11 yet, and that one is arguably a bit difference already. The changes are incremental with the jump from C++03 to C++11 being the bigger one.

  2. C++17 is new enough that I wouldn’t expect many books to have made it through the pipeline yet, so I hope you’re okay if some of my suggestions only cover up through C++14, or are still in-process of updating to C++17.

    One resource I _did_ find useful is https://github.com/rigtorp/awesome-modern-cpp – this links a variety of sources on modern C++, many of them non-book (and some that probably will, in time, become books).

    The one I honestly found most useful could be construed as the “Clean C++” book you reviewed done correctly – that is, the C++ Core Guidelines at https://github.com/isocpp/CppCoreGuidelines. It lays out a set of recommendations, gives concrete reasons why these are suggested (resulting in better compiler codegen, improved memory or type safety, less error-prone for later users of the API, etc). The recommendations are organized into a sensible categorization system, and they are actively asking for feedback on exceptions, counterexamples, and additional rules.

    Another that I’ve seen VERY high praise of is Scott Meyers’ Effective Modern C++: http://www.amazon.com/dp/1491903996 – it only covers up though C++14, but the gap is much smaller than it otherwise might be, and some of it can be filled by the C++ Core Guidelines.

    C++ Concurrency in Action’s first edition only covers C++11, but the second edition is currently in-progress, and will cover up through C++17: http://www.cplusplusconcurrencyinaction.com/ – this may also help fill the post-C++14 gap in Effective Modern C++.

  3. A minor point, but I don’t think it is fair to say that the broken windows theory has been discredited. And, just anecdotally, it’s very applicable to codebase maintenance in my experience.

Comments are closed.