Historically all my side projects are in different languages since I either learn a new language to do a side project, or that language is particularly suitable for the task. Apple Swift has been my main working language for many years—unfortunately it isn’t useful outside the Apple ecosystem. Besides, learning new languages is fun.
In the recent years I have been drifting more to the languages that I can start learning and using once, and then come back months or years later, and keep doing what I was doing—because that is how I do my side projects. I work on a project for a while, and then often don’t touch it for a year or more. By that time, if I don’t do anything else in that language, I’ll have completely purged it from my active memory. I will need a refresher, but I’ll be sure that in the time I didn’t look at it, the language has not completely moved on from under me like JS is doing these days. Some languages like that would be Go, C++, Lua, Common Lisp… you get the drift. Some would say Rust fits the bill, but it’s a bit too volatile for my taste.
All of this long-winded introduction has been for the fact that C++ is moving fairly slowly, which is why I can recommend some older books and resources that are still relevant, especially if your goal is to remember the basic syntax and how the language works, the newer standards have not changed C++ so radically yet.
What do I mean by “getting back” into C++? Right now I’m a the point where I’ve committed to my C++ side project for the last time more than a year ago—the last meaningful change has been in September 2020 (and now it’s February 2022). I remember what I was doing, and I know what I need to do, but I forgot the language simply because I wasn’t using it.
Just like when learning a foreign language, you need 2-3 days in a foreign country to really get it “activated” and start speaking, I need to browse some programming language resources (videos, books) to re-activate it and start writing code again. Some people like to jump in and write some simple code, but it doesn’t work that well for me. It’s great for learning the language initially, but not for reactivation.
The goal of this exercise is to refresh in memory the syntax and common approaches and to get used to reading and writing C++ again, with good form. An important note: my side project uses C++17, so my recommendations will be skewed toward the older standards (11–17). There are whole books out there (for example, Rainer Grimm’s “C++20: Get the Details”) covering the changes that C++20 and C++23 bring (and they are quite significant) but they are out of the scope of this post.
Online resources
I don’t include any cheatsheets or one-page language summaries here because I find they don’t work that well me. You can find some pointers (*snicker*
) in one of the awesome-cpp lists.
- cppreference is an invaluable resource if you want to keep your feet intact while writing C++ and I always have it open. In a pinch, it can be used both as a guide and a refresher, starting from the homepage—it provides an overview of the whole language at a glance and you can drill down into the topics you want to learn more about. If I could choose only one link to have in this whole post, that would be it.
- C++ Core Guidelines is an effort by Bjarne Stroustup and Herb Sutter to compile a “document” that would help you “write modern C++ effectively.” Now it is as large as a book and has hundreds of specific guidelines that should help you write idiomatic C++. Certainly, not all of it is directly applicable to every project, but a lot of it is sensible advice worth skimming. Remember, we’re trying to get an overview of the language here and remember what we already know.
- C++ Best Practices led by Jason Turner are a compilation of both C++ language and ecosystem overview that, again, should help you write idiomatic C++ while keeping both your feet intact. There is too much written about how you should write C++ already, so all of these are short and to the point, and are a great way to jog your memory.
- CppCon “Back to Basics” series of videos on YouTube (2019, 2020, 2021). If you can take video, I highly recommend this series covering specific language angles in sufficient depth: templates, pointers, concurrency, how lambdas and
constexpr
work, and on and on. It’s not a linear series, you certainly don’t have to watch all the videos, but I’m sure you’ll find some that are interesting and cover something you’re fuzzy about.
Books
I’m a big fan of using books to explore programming languages. As I said above, you can jump in and start coding, but where does that take you in terms of covering the language as a whole? I think you’ll do much better skimming a thick book and discovering all of what the language has to offer. I personally used Bjarne Stroustrup’s “Programming: Principles and Practice Using C++” (that is more than a thousand pages long) in this way when initially learning C++, and recommend this approach if you read quickly and don’t mind skipping a few pages here and there.
- Bjarne Stroustrup “A Tour of C++” (second edition). I might be jaded, but I think Stroustrup’s books are simply nice to read, I like his tone. Might not work for everyone, but works for me. This second edition of “A Tour of C++” is fairly short at 256 pages and gives exactly what it says on the cover: a quick tour of everything C++ up to the C++17 standard. This is a perfect example of a book you can quickly flip though and remember all you’ve learned about C++ a couple of years ago (that’s why I’m putting it in the first place on the list).
- Josh Lospinoso “C++ Crash Course” from No Starch Press is a mixed bag. I found it easy to read and you can move quickly—it’s almost 800 pages but you can skip what you don’t need. At the same time, some code practices that the author suggests are… questionable, or at least that’s the impression I’ve got. The book is highly rated and structured differently from Stroustrup’s C++ introductions (and uses a different tone) so you might find it more palatable. I personally read about a half of it (alongside others) before I felt I understood enough to start writing some code.
- Jason Turner “C++ Best Practices,” while named like the “C++ Best Practices” repo I linked above, is a fuller, differently structured version that includes exercises and is in general easier to read than mucking about in the repo. It’s a whole book, after all. I’ve been following his work for years now, and his pragmatic approach and recommendations come from practical experience, and something I can get behind. The book is just 130 pages long and is well-worth a read for aligning your thinking about writing C++ correctly. For every topic, it also provides links for additional reading and watching.
Now, let’s get to coding.