DEV Community

Cover image for C++ is a good first language to learn
Amanda Fawcett for Educative

Posted on • Originally published at

C++ is a good first language to learn

You might be compelled to think of C++ as an old and moldy programming language.

Developed by Bjarne Stroustrup at Bell Labs in 1979, C++ is the foundation for a lot of technology, and a very popular first programming language taught in schools.

Despite the advent of popular object-oriented programming languages like Python, C++ has a dedicated space in the tech world.

In any application that absolutely requires fast machine performance, chances are it’s powered by C++. AAA video games that require advanced graphical capabilities and speeds run on C++. Anything with a GUI tends to be built on C++ (like all the major operating systems and web browsers).

That’s not to mention the rise of the IoT, embedded systems and resource-heavy VR and AI applications — all of which are usually based on C or C++. There’s plenty of life in C++ yet. And for a beginning programmer, C++ is one of the smartest first languages to learn.

Want to learn more about how to learn C++? Check out this blog post for a complete beginners guide

Why learn C++ in 2020?

Truly understand how computers, compilers and languages work

C++ is close to the metal — just a few small steps away from assembly code. While other programming languages are built around the business domain, C++ is built around the computer. This gives you a much greater understanding of all the building blocks of programming (useful when you’re starting out).

Alt Text

C++ allows you to learn programming from the ground up. You have to explain everything you do, which gives you a deeper understanding of how all the parts work.

A mastery of C++ will familiarize you with:

  • Efficient memory management and pointers — why they’re important and what they do
  • Meta-programming — how a program can examine information about itself
  • Compile time and load time — the difference between them
  • Optimization — what it really means, and how to optimize while you code
  • Dynamic libraries — how they really work, and what to do with them
  • Generic programming — programs evaluated at compile time

Pick up other languages more easily (if you’re starting here)

Most other major programming languages have syntax based on C++. If you get a good grasp of C++, you’ll be able to pick up other, more verbose languages like Java, far more easily. C++ helps to understand the logic structure of all programming.

It’s actually a lot harder to start with another programming language, and then move to C++. A language like Python, optimized for the way humans think, won’t teach you the way computers think. You may need to re-learn programming from the ground up, if you move to C++.

C++ doesn’t tie you to a specific programming paradigm (like object-oriented programming), so you can easily experiment with different techniques as you learn.

Be a developer that companies want to hire.

There’s a big shortage in the industry

Not a developer shortage — in fact, there are more developers on the job market these days than ever. Universities and programming bootcamps are churning out developers who specialize in a particular programming language or framework. These devs can jump right into a job tailored to their specialties and start plugging away.

The real shortage is in raw problem solvers. This is what hiring managers are looking for in interviews. This is a skill that no machine or AI can replace (yet).

And C++ teaches you how to be a real, raw problem solver.

One common complaint about learning C++ is that there’s hardly any abstraction in it. You have to define just about every attribute to make the code work. This can result in more complex, lengthy code to write and dig through, unlike more elegant languages like Python.

There’s no garbage collection — you must explicitly mark objects to be deleted. And memory management is done manually. You are in full control. And when something breaks, it’s on you.

This is where the real programming skill is developed. Code runs slow? You’ll need to figure out where the memory is being wasted, and how to dynamically allocate it. Got a bug? You’ll need to roll up your sleeves and search your code. An inconvenience for sure, but one that builds character, and dev cred.

You’ll learn to adopt a more clear and consistent coding style, comment the code as you write it, and learn to limit the visibility of class internals to the outside world — all important facets of object-oriented programming.

Learn C++ more easily

As you might have gathered, C++ isn’t the easiest programming language to pick up quickly. The learning curve is pretty steep. But with the right mindset and tools at your disposal, learning C++ can be fun and enriching for any developer. Here are some points to keep in mind as you learn:

Be a problem solver

Alt Text

Any beginning coder should have a question they ask themselves any time they encounter a new syntax feature to learn:

“What problem does this solve?”

All programming is made to solve problems. By focusing on what problem you are solving with each new thing you learn, you’ll get a much deeper understanding of the language and programming in general.

If you can’t answer the question, there are plenty of resources at your disposal. Did you know C++ questions have the highest answer rate on StackOverflow?

Get acquainted with the latest version of C++

C++17 is the most recent version of C++, but it’s an incremental update from C++11, the last major upgrade. You’ll definitely want to start there. There are many new features designed to make C++ easier for beginners to pick up, and lots of ways to make your code shorter and easier to read.

Learn with a good teacher, and at your own pace

Most programmers will agree: a good teacher can spell the difference between mastering C++ as a beginner, and banging your head against a wall. There’s simply no substitute for good instruction.

It’s also important to practice as you learn. You need live code to play with as you learn about it, and the opportunity to move at your own pace. C++ may not be as intuitive as other programming languages you know, so getting down the basics and then jumping into hands-on practice is a great way to learn. If you want to get started, you can check out this free Learn C++ from Scratch course.

Further Readings and Resources

Thoughts on this article? Do you have a different opinion about a good first programming language? Feel free to comment below.

Top comments (3)

htho profile image
Hauke T.

I started Programming with QuickBasic in the early 2000s. I wanted to move to a more sophisticated language and tried to find a tutorial for C++. (It was not that easy back then) I wanted to try something simple first, like a number guessing game. But the tutorial was like "you dont even know if the machine you are coding for has a terminal" After that sentence I closed the tutorial and and ditched the idea of learning C++ and moved to python instead.

... I just wanted to share this 18 years old story with you...

There are so many concepts one needs to learn. before you can write one single line of code. ie. one needs to choose an IDE and a compiler first. There are so many options. It is overwhelming.

imnhema profile image

Awesome article Amanda. Often see posts like " Why are people still learning c++ when it's old" on Quora. Will definitely be sharing this.

amandaeducative profile image
Amanda Fawcett

Glad to hear it was a helpful read!