Learning C++

I've been thinking about creating a blog where I could register thoughts and things I learn during my experience as a programmer for a long time. Always waiting for a better occasion, I started piling up some resources I found helpful in the last year. "Eventually, I'll post them somewhere". In the last weeks, inspired by a thread on Twitter and some answers, I decided it was time to start and try this out.

This post tries to informally list some good resources, so that beginners and people coming back to C++ after a pause can find some pointers guiding them.

Hopefully, this will help someone!

Learning C++: useful resources

according to a clueless computer science student

For context, 2020 was the year I decided to "get back" at C++ after a negative experience with it in my first years of university. Probably, I never searched hard enough for good resources; maybe, I was scared by the reputation the language has. In hindsight, I wasn't looking in the right direction for sure. I have heard that the good resources available to anyone greatly increased in the last years too.

When I started searching, I was pretty surprised to see there were so many. Selecting good ones and avoiding misleading ones can be tough too, especially for a beginner. I admit I was lucky in meeting very good ones at my first shot.

In my experience, when talking to other students about C++, what frequently comes up is pointers, references, object, classes, memory management and... how scary they can all be. Until last year, I was pretty confused about all these concepts dancing around in my memory. "What's a pointer?", "what's a reference?", "should I sprinkle new whenever I create an object?" and so on.

First things first, then. I'd definitely recommend to approach C++ basics before exploring the rest of the language. Where to start? I can recommend binge-watching Kate Gregory's courses including:

They are clear, concise and promote good practices, which is something you want to assimilate as soon as possible from people proficient with this language. Follow those practices, they'll spare you headaches and a lot of debugging time.

Another series of videos I appreciated in my learning process was Yan "TheCherno" Chernikov's series about C++. I would recommend watching this following their release dates: even if they are not structured as Kate Gregory's courses because of Youtube's nature, they guide you through concepts from simpler ones to more advanced ones, with plenty of examples and curious notes.

If you are looking for a welcoming, inclusive community that can help you through your learning process, you should definitely look at #include<c++> and their Discord server. There are lots of ideas, interesting cues on where to look, experienced people and others learning the language. Also note that the site has a page with other valuable resources which you may want to look at.

Once you are done exploring the fundamentals and the basics of C++, you may want to delve into a specific feature that made you curious. Here's some talks I found interesting; these helped me understanding some concepts better and I found even more value by watching them more than once.

Once you are done with these, you may have different questions about other details of some features; you may want to know more about standards and what's different about each of them (and why they are important); you may want to discover even more about the standard library. That's great, and... I have some more suggestions for you.

While you are exploring all of these concepts, you may want to try and write some code, test some features, practice your understanding of the last technique you have heard about. Matt Godbolt offers you Compiler Explorer, where you can write C++ code, compile it with different compilers, make it run and even share it. If you have an idea and you need to test it on the fly, or you have some code you want to share while asking questions, you should use Compiler Explorer.

An important note about asking for coding help is in this article from Kate Gregory. I won't spoil it for you, but I believe this contains both plain truth and good observations and it will help you growing as a programmer.

If you need clarifications about a feature of the language, a part of the standard library, how a class or a function works or what is in that particular header you saw some people including on top of their code... You want to search on CppReference. This is what was recommended to me, and what I saw people much more qualified than me recommending. It might take you a while to get acquainted to navigating its sections and reading some descriptions, but it is definitely worth the effort.

We also referred to best practices that you want to adopt while coding. There are places that collect many guidelines ordered by topic, feature or concept.

You may also want to look at C++ FAQs. If you prefer watching talks over reading, I may recommend:

About exploring what is in each standard, I have to point at C++ Weekly with Jason Turner, a wonderful collection of videos about C++ features, from basics to more advanced ones. The following videos sum up the most notable additions to each standard with some examples:

The "show-and-tell" worked great for me. Also, Jason constantly encourages following best practices, which is another good reason to watch his content... weekly.

For a deeper dive in C++17, I can recommend both Practical C++17 by Jason Turner and C++17 Features (part 1) and (part 2) by Bryce Adelstein Lelbach.

(We are almost done, I promise.)

Another recommendation I feel I should make is using the Standard Library, its tools and its commodities. They are there to be used and they will definitely help you, if you learn how they work. Iterators and algorithms are what you want to study to get better at conveying intent while being efficient and avoiding to re-invent the wheel. Three talks that hugely motivated me looking into those are:

If you want to learn using them with a smoother learning curve and someone illustrating them to you step by step, I have to recommend you another one of Kate Gregory's courses, Beautiful C++: STL Algorithms: through presentations and hands-on examples, Kate explains how you can remember them, what some of those have in common and how easy it can be using them and taking advantage of their properties.

For even more pointers to useful content, Lesley Lai recently wrote a post about Resources that help you delve into C++, that inspired mine and that I recommend going through; Lesley definitely has more insight than me on the topic.

Out we go...

That was surely a lot, huh? That's something that you should not be scared of, in my humble opinion. Those are mostly - if not all - free resources available to anyone that wants to approach C++ and learn more about it, and coding in general. I am a clueless computer science student, but I feel like I learned a lot in the past year. If I got better at coding and at reasoning about code, even slightly, I owe it to those resources, those people giving talks and the others working hard to enriching the community by sharing their knowledge and helping beginners and newcomers.

With my first blog post, I want to publicly thank them and hopefully help someone else, as they helped me.

Any constructive criticism, correction, note or comment about the post is welcome. Feel free to contact me on Twitter.

See you all in my next clueless post!