April 5, 2018 5 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#, Python, Javascript, Go, etc for application development and it seems 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:
- Web front-end development: Javascript/Typescript rule everything and the three popular frameworks in frontend are Angular, React, and Vue.
- Web back-end service development: Javascript (Node), Python (Flask, Django), Java, and PHP are the popular technologies used.
- Desktop application development: QT (PyQT, C++), Electron (Javascript), WPF (C#).
- 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 5 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.
– Javascript: The most popular Javascript engine V8 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 four.
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, Javascript etc, you need to know how the language binding works and 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. There are many C/C++ challenges on Topcoder
Here are some of the successful challenges on Topcoder.
Hercules Fog Recoder series (currently active as of 4/3/18)
https://www.topcoder.com/challenges/30062896/?type=develop
https://www.topcoder.com/challenges/30063516/?type=develop
Hercules pxCore series (currently active as of 4/3/18)
https://www.topcoder.com/challenges/30062701/?type=develop
https://www.topcoder.com/challenges/30063822/?type=develop
C Code documentation reverse engineering series
https://www.topcoder.com/challenges/30058416/?type=develop
https://www.topcoder.com/challenges/30058253/?type=develop
NASA Cassini series
https://www.topcoder.com/challenges/30054520/?type=develop
https://www.topcoder.com/challenges/30052340/?type=develop
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!
billsedison
Guest Blogger