7 Reasons Why You Should Keep Learning C/C++
Many programmers are frustrated with and leaning away toward the C/C++ programming languages because of the following reasons:
(1) Very steep learning curve..
Many people joined the programming world by learning C or C++, but it’s
rare for them to keep learning and mastering these two languages well
because they get frustrated in handling the low-level programming
elements such as pointers, the memory storage model, address alignment,
templates expansion, multi-thread data races, and so on. If these
elements are not handled properly, the app will have a high probability
of crashing, which will frustrate the new programmer.
(2) Rarely used in modern application development
Nowadays we have many advanced programming languages like Java, C#,
insane if someone wanted to develop a Web application or backend service
in pure C/C++. The common application areas have been taken over by
more advanced programming languages such as:
- Mobile application development: iOS (Objective-C, Swift), Android (Java).
- Distributed systems, Big Data, Cloud Computing: Java, Go, Groovy, Scala.
- Data science, AI (Artificial Intelligence), ML (Machine Learning): Python.
It looks like C/C++ are rarely used in these modern application
development areas. So why should we still learn C/C++? Here are 7
reasons why you should:
1. Master other advanced programming languages faster.
Almost all other modern programming languages and popular libraries are built by C/C++. Here are some typical examples:
– Java: The core of Java Virtual Machine hotspot is implemented in C++.
– Python: The Python interpreter is implemented in C.
– Numpy: One of the most popular scientific libraries in Python and it
is widely used in AI and ML, but its core module is implemented in C.
If you just remember the syntax of a programming language or can use
the common libraries well, it doesn’t mean you truly mastered the
programming language. Knowing the theory behind the languages can help
you develop applications in the language more efficiently, which then
means you truly mastered the language. But the prerequisite for all of
that is you have to know C/C++ well.
2. Bring performance.
When programming in the advanced programming languages, we mainly focus
on the implementation of functionalities. We usually use guidelines of
best practice to avoid silly mistakes but it is not nearly enough when
you need to gain better performance. Better performance requires careful
profiling and analysis to find out which code are the performance hot
spot and how to rewrite them in a more efficient way.
If you know C/C++ enough, then it will aide you in gaining a better
performance because you know how these advanced programming languages
run at its lowest level. You will be able to discover the issue faster
which may be performance decay, the expensive CPU instructions, the
cache miss, the tradeoff of context switching, or something else.
3. Understand the fundamental computer theories well.
Computer networks, operating systems, computer architecture, and
compiler theories are four of the most important fundamental computer
theories and almost all of our new techniques are built based on these
If you are just programming in the advanced programming languages,
these machine-level details are usually hidden from you. But these
techniques are really important if you want to jump out of the existing
frameworks and develop something more.
For example, when the network status is unstable and you need a
reliable connection you would not solve the issue with TCP because TCP
brings a large latency due to its large retransmission timeout. So how
should you do it?
If you understand a computer network well, you can build your own
reliable protocol with more aggressive and efficient retransmission
schemes. You would then need to integrate it into the network’s SDK and
you may need to know how the network protocols are implemented in the
Operating System. Your implementation should be efficient so you have to
know the computer architecture well too such as using the CPU cache,
memory, and network adaptors effectively. Finally, if you want to
provide API interfaces for other advanced languages, like Python,
compiler theories helps with that.
Most importantly, all these key techniques are based on C/C++.
4. C/C++ powers the world
C/C++ is everywhere. In particular, they power more technologies than we give it credit for.
Most operating system kernels are written in C, including but not limited to Windows, Linux, Mac, iOS, Android and so on.
Modern browsers are also written in C/C++. like Chrome, Firefox etc.
Modern game engines are written in C/C++, like Unity3D, Unreal Engine, cocos2d-x etc.
As mentioned above, programming languages compilers and interpreters are implemented in C/C++ too.
According to the TIOBE Index for March 2018, C/C++ are still the most
popular languages. So don’t hesitate to keep learning these two
languages that are still powering the world.
5. Interfacing languages
The problem here is that the C++ interface and ABI (Application
Binary Interface) isn’t standardized, and depends on the compiler you’ve
used. If the library was compiled with a different compiler (or even a
different version), you might not be able to call into it.
Not so with C, where the interface is defined and standardized, and is used by many other languages as well.
6. Efficient machine code produced by C++ compilers
Uh, no. C++ not only suffers from the same problem as C here (the
language basically can’t make any guarantees whatsoever about the code),
its hideously complex syntax prevents compilers from even compiling it
There’s a reason why the OCaml compiler can produce faster code than C
compilers, and why C++ programs are so huge when compiled.
7. You will hardly be seen as a hacker if you don’t know C++
This is an excellent point for generating flame wars, since it relies
entirely on your definition of a hacker, and what you think of C++.
Personally, I know C++, and I want my lifetime back that I spent
working with that language. C++ is needlessly complex, the “OO” is a
joke, and it has so many hidden traps I’m surprised no one has been
eaten yet by a C++ compiler.
And the fact that C++ is an almost complete superset of C might have
been a good idea to win over the C programmers, but it also means you
get all of Cs problems like the preprocessor, and casting, etc.
Someone with a passion for programming languages might know C++, but I can’t imagine them really liking it.
So get started with C/C++ and keep learning. Don’t be scared off by
its difficulty and steep learning curve. Once you have mastered them,
you will gain a lot more knowledge than you expected!
Computers are not about calculations, they are about
information—organizing, retrieving, and manipulating it. You want to
write efficient programs? Then you need to understand and learn to work
with data structures. Data structures and algorithms tell you how you
can put the programming languages you mastered to good use. Pick up C
and C++ and implement and play around with data structures, and see how
exciting it all is. In spite of young upstarts, dependable C and C++
continue to be the programming languages of choice for several
Subscribe to get your daily round-up of top tech stories!