Relearning C++ in 2021

After a terrible 2020 when my most plans for the year failed to manifest, I’ve been working on a fresh start in 2021. I want to make broader changes for all the aspects of my life, including fitness, career, and personal development. In career + learning, I’m learning C++. I also want to learn Rust, but more on that later.

Learning for the first time

I learned C++ for the first time in 2013 for the data structures course at my college. While I understood the data structures, I found C++ to be quite tricky, especially with the pointers and references. I’d put high blame on the course because now that I look back, it was a terrible class based on learning the programs to pass exams rather than learning to create them.

Relearning for the first time

I moved on to Java and did not look back at C++ until 2017, when I took an Algorithms class with Prof. Pavlu at Northeastern University for my masters.1 I refreshed my C++ skills through an online course to use in the class while implementing algorithms into programs. Why C++? I thought Java was verbose.

But my association with it did not last long. My next class was required development in JavaScript frameworks like Angular and Node.js. Afterward, it was Java for MapReduce, Python for information retrieval, and MATLAB for robotics for the next one and half years.

Relearning in 2021

Okay, so back to the present. I started leetcoding around the last quarter of 2020 using Python. However, looking at my resume, I felt uneasy that I was under-confident in some of the skills mentioned there. My side projects looked old and boring. I felt weakening at many of the core computer science skills that I had learned during my more than half a decade studying the subject. I wanted to get back to the roots.

Looking for an inspiration

I started looking for something to learn, something exciting and with enough potential for career development in the long term. Many JavaScript-based frameworks are trendy these days, like Electron, React, and more. While I have learned JavaScript in the past in Angular and Node.js, I haven’t been able to love it. So, I skipped it.

I also entertained the idea of developing something in Python using PyTorch, Sci-Kit, and Num-py for related to ML. Having taken many such tutorials, I feel that many popular tutorials are banal; almost all of them use similar library-defined functions on some data, which is great if one knows what to do with that output. But I am not looking for this unless I have a good idea for an application.

I gave some thought to Swift as well. But Swift is constrained to the iOS development, and I decided to skip it for another day. I passed on Flutter as well.

Playing with Go and Rust

While surfing through the pages of Hacker News and blogs relevant to computer science and software engineering, I sensed that Go, developed by Google, is popular in the present and Rust is the future.

I played at the Go playground. I like the language and its idiomatic style. Compared to C++, it’s simpler and easier to write since C++ is relatively verbose. Go is an excellent choice for many projects where C/C++ would be too low and Java too corporate. Many tools for efficient app development and deployment have been created using Go, like Kubernetes by Google, OpenShift by RedHat, and Docker. I think I’ll dive deeper into Go but not yet.

I find Rust, developed initially at Mozilla, to be more interesting, however. Rust is supposedly an alternative for C++. Many threads on Hacker News are comparing and contrasting C++ and Rust. Rust has many features that make this language more comfortable to work with, like Cargo package manager, and Crates is the website to download other packages or publish your own. This type of ecosystem can make it a little easier for the developers to build projects and find libraries that exist.

I read the half-hour to learn Rust post, which ironically states ‘51 minutes to read’ in the byline.2 But I feel it has a longer learning curve, at least initially. Hence, I’ve decided to learn it after relearning C++, which I’m more familiar with.

Relearning C++

So now, back to the task at hand. I chose C++ because it is not as low-level as C, not as verbose as Java, and not as high level as Python. C++ is beautifully amorphous.

Again I drowned myself in different threads on Hacker News and found multiple great resources. And I was wonderfully surprised to find that C++, while with a definite learning curve for beginners, is a powerful language with extensive libraries built over decades of experience. It’s easier to use and work with since it can be written in functional or object-oriented programming. C++ is fast and runs some of the most popular systems, including iOS, macOS, Google Chrome, Mozilla Firefox, Adobe Photoshop, and Sublime Text use C++.

I followed the following resources:

Learning concepts

  1. cplusplus.com’s tutorial: I started with C++ starting with this which is an excellent introduction to the language. Since I’m very much familiar with programming and C-style languages, I went through most of the pages quickly while attending topics newer to me.
  2. The Cherno: This YouTube channel has videos explaining various C++ concepts, including examples like game development.
  3. CppCon: The C++ Conference is a platform where many C++ experts are speakers, and different C++ concepts are elucidated, making them easier to understand. For example: Back to Basic: Move Semantics (part 1 of 2) by Klaus Iglberger.
  4. I’ve found Bjarne Stroustrup’s books The C++ Programming Language and A Tour of C++ are also recommended by many.
  5. MeetingCpp: Another YouTube channel that glosses over several C++ ideas.

Practice

Practicing programming in C++ is essential to get well versed with its syntax because there are many data structures and functions, and it’s not easy to remember them just by reading the examples. Websites like HackerRank and LeetCode are great for that.

While I’ve read through many more resources, the ones listed above are those which I found most helpful in understanding the details of C++. I’ll keep adding more resources throughout this year as I continue to relearn the language this year.