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 continues 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!