Should I learn Rust or C++ in 2023?
If you are interested in working on large systems, games, servers, search engines, electronics, etc. you should learn C++.
On the other hand, if you are interested in building command line tools, network services, embedded systems, webAssembly, or systems programming, you should learn Rust.
Both Rust and C++ are popular choices for systems programming. Rust helps developers to have low-level control without giving up high-level conveniences.
C++ was designed with an orientation toward system programming and embedded, resource-constrained software and large systems, with performance, efficiency, and flexibility of use as its design highlights.
Choosing which programming language to learn can trick, there are many factors to consider when learning a new technology or programming language.
Popularity, opportunities, types of projects, salaries, resources, learning curve, etc. are some of the factors that many people consider when choosing to learn a programming language or a framework.
Here are some of the considerations you should make when choosing to learn a new programming language.
POPULARITY AND OPPORTUNITIES
If you want to learn a programming language or framework solely for its popularity among developers, you should learn C++.
C++ is a very popular choice for developing operating systems, compilers, embedded systems, servers, telecommunications systems, game engines, AAA games, and more.
Generally, C++ is more popular than Rust. According to a Stack Overflow survey of 2022, C++ is the 10th most commonly used programming language, it is used by 20.17% of professional developers.
On the other hand, Rust is the 15th most commonly used programming language, it is used by 8.8% of professional developers according to the same survey.
It is worth noting that Rust is a newer language compared to C++, it is actually rapidly growing in popularity. Rust has been the most loved programming language for seven years straight.
As of 2022, Rust is loved by 86.73% of developers versus 13.27% of developers who dreaded it. Compare that to 48.39% of developers who love C++ versus 51.61% of developers who dreaded it.
Ultimately, if your choice of which programming language to learn depends on popularity, you should learn C++.
Plus, there are more opportunities for C++ Developers than Rust developers because C++ has been around for a very long time and has been used on many systems than Rust.
However, because C++ is very popular and commonly used by many companies, there is going to be more competition for C++ opportunities than for Rust opportunities. In this regard, a Rust developer may get a job easily because of less competition.
Here are 7 jobs that you can get as a C++ developer.
Another popular criterion that many people use as an incentive to learn a new programming language is salary. Salaries for developers differ from one company to the other and from one country to the other.
Experience is another factor that comes into play as far as salaries are concerned. The more experience you have with a certain technology or programming language, the more likely you are of getting a higher salary.
Generally, C++ developers get higher salaries than Rust developers. Glassdoor reported that in the United States, C++ developers with 1 – 3 years of experience get a base salary of $94,116 per year.
On the other hand, Rust developers with 1 – 3 years of experience get a base salary of $82,407, about $11,000 lower than C++ developers.
So, if the salary is your major incentive for learning a language or framework, you should learn C++, because you are more likely to get a higher salary as a C++ developer than as a Rust developer.
Some programming languages can be learned more easily than others. If you want a programming language that is beginner-friendly and develop different types of applications, you should learn Rust.
Rust is far much easy to learn than C++, its syntax is easy to read and write. Even when you are targeting low-resource devices, Rust will give you low-level control without giving up high-level conveniences, this makes it a little bit easy to work on systems.
Contrastingly, C++ is one of the most difficult languages to work with. C++ is not very easy to learn and work with, C++ concepts that allow developers to allocate and deallocate memory make it even harder to work with the language.
The good news is that there are many helpful resources for both Rust and C++ to help you learn the languages. The Rust and C++ communities are very active and helpful, in case you get stuck with something.
PERFORMANCE AND FEATURES
If you plan on working on applications where top-notch performance is critical, both Rust and C++ will do the job just right but C++ is still a little more performant than Rust.
C++ is a very fast and high-performance language, it is one of the few high-level programming languages in which petaFLOPS computations have been achieved, others being C, Julia, and Fortran.
C++ has many advanced features that make it a popular choice for developing operating systems, compilers, game engines, video games, servers, space probes, desktop applications, telecommunication systems, embedded systems, and many other large applications.
C++ is used by many companies such as Google, Meta, Microsoft, Intel, Adobe, IBM, Epic Games, LinkedIn, NASA, Apple, and many others.
Rust has great unique features that make it suitable for building command line tools, network services, embedded systems, and more. One of the best features of Rust is how it handles memory.
While developers have to manually handle memory management in languages like C++ or use a garbage collector with languages like Java, C#, Kotlin, Go, etc. Rust takes a unique approach, developers can still handle memory without shooting themselves in the foot with a concept of ownership and borrowing. This makes it easy and quick to build reliable and efficient software.
Rust can also interface with other programming languages such as C and C++, it has a foreign function interface that can be used to call code written in C from Rust and to call Rust code from C.
Rust also has a library called CXX that can be used to call C++ code from Rust and to call Rust Code from C++.
There are many companies using Rust, some of the popular ones include Dropbox, Firefox, Cloudflare, Microsoft, Amazon, Google, Facebook, Discord, Mozilla, NPM, etc.
Once you have evaluated all the factors, you can choose which programming language to learn depending on the factors that are on your side and what you want to build.
If you want to learn easily, develop systems quickly, and work on command line tools, network services, embedded systems, and webAssembly, you should learn Rust.
If you want to work on large systems, performance-critical applications, AAA video games, and get a higher salary, you should learn C++.