Discovering Modern C++, 2nd Ed

Author: Peter Gottschling
Publisher: Addison-Wesley
Pages: 576
ISBN: 978-0136677642
Print: 0136677649
Kindle: ‎ B09HTJRJ3V
Audience: C++ developers
Rating: 5
Reviewer: Mike James

Modern C++ who would want to write anything else? Is this a suitable introduction for the rest of us?

The subtitle: An Intensive Course for Scientists, Engineers, and Programmers. indicates that the examples are mostly about number crunching, but this shouldn't be a problem for most programmers. 

My first comment is that this is a strange book - in a good way. It is an odd mix of bottom-up presentation in the style of, say, K&R plus a very chatty style, full of off-the-cuff remarks. This makes it a strange mix of a reference manual and a discursive introduction to ideas. If you can't cope with the author's style you aren't going to like this book - personally I found it very readable. What I didn't find readable was the font and the paper used for the print edition. For an expensive book this feels very cheap.

This second edition has been brought up to date with entries on C++ 20 and it isn't an extensive rewrite or reorganization.

The reference manual part of the presentation can mostly be ignored when you are just reading it, but my guess is that you will return to it as soon as you encounter something unexpected while programming. As the book moves on, the reference aspect becomes less and less and the tutorial aspect starts to dominate. 

Banner

Chapter 1 starts off with the very low level details of C++ - constants, literals, operators, expressions, functions, error handling and so on. If you have no idea how to program this is going to mean nothing at all to you. Even if you program a little in a non-technical language like JavaScript, this is going to be too dense and too much. As long as you have encountered this material before in another language there should be no problem and you will be aware that skim reading, looking out for the author's comments' is the best way to get to chapter 2. By the time you reach the end of the introductory chapter you have completed a crash course in the foundations of the language by reading an annotated reference manual.

Chapter 2 launches into object-oriented features of C++ - classes, members, constructors, destructors, accessing members, operator overloading and more. The style here isn't quite a reference and there are lots of discussions, such as what the copy constructor is for and why you might want to write one. Anything that is fairly obvious is just presented to you as a reference text and it is only the less than obvious that is explained in detail.

 

Where do you think the author is going to go next? No not more objects but deep into generics. The reason, I can only guess, is that for scientists and the like expressing algorithms in a type-independent way is a priority. It is, but it is still early for generics to feature in such detail. Chapter 3 not only covers the basic ideas but some of the newer "modern" C++ features, such as lambdas, variadic templates, concepts, functors and so on. At this point you also cannot miss the fact any longer that the examples are from applied math - numerical integration for example.

Chapter 4 introduces the standard template library - again a good choice for a book aimed at the technical programmer. Here we learn not just about  containers but complex numbers, tuples and libraries that go beyond the standard template library with a distinct applied math emphasis - linear algebra, OEDs, PDEs and graph algorithms. 

Chapter 5 is about meta programming which is again "modern" and not something that all C++ programmers would want to know about in such detail - type traits, conditional exceptions, compiler optimizations and so on. I found the section on Meta-Tuning particularly interesting.

Chapter 6 returns to object-orientation, which has played a minor role so far given how central it is to C++, after all it is what makes C++ a step on from C. In this chapter we learn about some very advanced ideas like multiple inheritance and many things that should have been introduced much earlier in the book - derived classes, the inheritance type hierarchy, casting and so on. 

The final, final chapter of the book is about scientific projects and here we discover what the author is really interested in using C++ for. The projects are mostly about solving differential equations. Is C++ really the new Fortran?

There are also three Appendices which are well worth reading. Apendix A ClumsyStuff is particularly interesting - a sort of "what I couldn't logically fit in elsewhere" chapter. This appendix could well be extended into another book.

This is an excellent book as long as you are not a complete beginner and are a scientist or similar and are particularly interested in C++ as a numerical or scientific programming language. If you fall outside of this target audience then how much you will like the book depends entirely on how far outside the audience you are. I think that the general C++ programmer could get a lot of fun out of reading this book.

 

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.

Banner


Machine Learning For Dummies, 2e (Wiley)

Author: John Paul Mueller
Publisher: For Dummies
Date: January 2021
Pages: 464
ISBN: 978-1119724018
Print: 1119724015
Kindle: B08SZHJGJW
Audience: General, but not too dumb
Rating: 4
Reviewer: Mike James
Dummies probably need machine learning to cope...



Testing JavaScript Applications

Author: Lucas da Costa
Publisher: Manning
Date: April 2021
Pages: 512
ISBN: 978-1617297915
Print: 1617297917
Audience: JavaScript developers
Level: Intermediate
Rating: 5
Reviewer: Ian Elliot
Testing the most web's fundamental language is clearly important...


More Reviews

 

Last Updated ( Sunday, 19 June 2022 )