Introduction:
The author of this article is Teacher Zhao Yan, personal website: http://zhaoyan.website/blog/index.php/2017/07/15/future/
There are many interesting articles on Teacher Zhao’s website, I recommend checking them out.
This article has been authorized for reprint.
Evaluating any programming language is bound to attract criticism. It’s always like this. Just like in the chilly spring, when people wearing cotton jackets and those in light clothing pass each other, both will likely think the same thing: “fool!” This is known in psychology as the “dichotomy phenomenon”!
So why do I want to do this thankless task? As the author of the books “Drops of Knowledge of C++” and the translator of “New Thinking in C Language, Second Edition”, I feel it is my responsibility to systematically introduce this language, its characteristics, and its future. This question is crucial for many newcomers entering the programming industry. They are deeply worried about what will happen if C language becomes obsolete like Fortran or Perl.
First, here is a chart, the famous TIOBE language ranking. Currently, it is the most authoritative ranking of language popularity, and from this ranking, you can get a straightforward conclusion. Java and C are both on the decline, and the declining portion is being divided among the languages ranked third and below.
(Note from the coder: This is last year’s ranking, the latest TIOBE data shows Java and C ranking first and second with 17.8% and 15.37% respectively)
For all programming languages, their ultimate goals are actually two: to improve hardware running efficiency and to improve programmer development efficiency.
Unfortunately, these two points cannot coexist! You can only choose one. In terms of improving hardware running efficiency, C language has no competitors! For example, to implement a list, C language uses an array int a[3], which after compilation turns into a method of (base address + offset). For computers, no operation is faster than addition, and no access method is faster than (base address + offset).
C language has compressed hardware running efficiency to the extreme. The problem caused by this design philosophy is the lack of usability and safety. For instance, you cannot mix different types in an array; otherwise, the compiler cannot calculate the correct offset. At the same time, C language is indifferent to incorrect offsets, which leads to the notorious buffer overflow problem in C.
C language’s claim of “trusting the programmer” is just a pretty phrase; its only purpose is speed, either a rapid run or a rapid crash. C language only cares about how high the program flies, not whether the programmer is exhausted. That’s just how it is!
Now let’s look at those non-C languages; their strengths lie in improving programmer development efficiency. They either support dynamic lists or safe lists. However, adding any intermediate layer or safety checks cannot be faster than (base address + offset + no checks). There is no language in this world that offers “easy development and fast execution”; easy development ultimately stems from layers of packaging over the underlying system.
Now let’s answer two common questions: Is there a need for software to be faster when hardware is so cheap? Most people with this doubt are regular customers at internet cafes; they only understand computers in terms of computer stores, and they see computing as just games and playing small movies from hard drives. Don’t get too excited about a game cheat; don’t forget about full-scene simulation, 3D rendering, and autonomous driving.
When driving, a person must collect data from 60 different objects every second, then make 20 critical decisions based on the different combinations and reactions of those 60 objects. Then from those 20 decisions, one is executed. So even with the fastest hardware, autonomous driving still cannot claim to drive like a human. Even if autonomous driving succeeds, the next step is autonomous flying, right? Because we’ve long predicted: why don’t you fly?
Therefore: computing speed is never enough! Because new applications will become increasingly complex and real-time. Oh, I also forgot a more important limitation: computing energy consumption! The CPU on NASA spacecraft is at most 32-bit; you might not believe it, but there isn’t a single 64-bit CPU on the International Space Station. I guess one main reason is that astronauts don’t enjoy watching movies on hard drives.
Another popular question is: Can I invent a language that is just as fast but without so many pitfalls as C? The idea is possible, and coincidentally, there is such a language, it’s called D language, but not many people use it! This is due to a fundamental fact. There is currently too much C code, and most of it is functioning normally, like Linux, Windows, MacOS, Unix, VxWorks. You read that right; the kernels of these operating systems are all written in C. I’m not sure about the proportion of C in Windows, but I believe that Microsoft wouldn’t be foolish enough to rewrite an operating system kernel entirely in C#. Getting those people to use your brand-new language is not just a bit naive; it’s completely naive!
Moreover, there are some codes that we simply cannot change! After NASA wrote a simple flight control software with 5 CPUs, it had to undergo a “full coverage” test. What happens if CPU A fails? What if CPU A and B fail? What if CPU A and C fail? If you wish, you can do a simple math combination. After testing, don’t even think about rewriting; just adding a comment is out of the question. Because the supervisor in charge of the payload will seriously question you, why the quantity of what you reported increased, but the quality didn’t improve? You need to explain to her in detail: hardware and software are different; hardware is the kind of thing you can touch, while software isn’t. Looking at the disdain in her eyes, you will deeply regret adding that line of comment.
Don’t take this lightly; this is a true story from NASA.
So why has C language declined so much? It’s simple; some tasks are not suited for C language. When I was in school, I even used C language to write window interfaces. Soon after, Microsoft released MFC, which is a bunch of macros that wrap the underlying C window API.
Later, this technology also became outdated. Because Microsoft realized that applications with windows are not fundamentally C language’s job; adding more layers increases the risk of exposing flaws, so they invented a brand-new language, C#, to take over this task.
Java follows this pattern as well, emphasizing networking, usability, security, and cross-platform capabilities. Whether it’s Java, C#, or Python, they intentionally avoid the issue of improving hardware running efficiency because they cannot compete with C on this point, nor can they shake the positions of existing C code like Linux, Unix, and GNU tools. What remains is just to focus on improving programmer development efficiency.This is good for C language, allowing it to shed what it is not good at and run faster!
With the rise of embedded and real-time systems, AI, robotics, and autonomous driving, these are all core applications of C language, and in these applications, C language has no competitors. Therefore, I feel that C language will stabilize in its core applications and begin to gradually rise again. (Note from the coder: Teacher Zhao was right; it indeed rebounded.)
However, I am not optimistic about Java language. In terms of compactness and flexibility, Python is far superior. After one line of Python code, you won’t even know if you are still duck-typed. In the platform domain, each platform has released its own exclusive language. Windows will continue to support C#, Apple favors Swift, Android has Kotlin, and Google uses Go. Java claims it can freely visit every home, but no matter where it goes, it finds a favored child sitting in the living room, making it somewhat awkward.
So I guess in the end, Java will stabilize in large non-real-time applications that have strict cross-platform requirements.
Lastly, a casual remark: C++ will not eliminate C language. Once you have objects, you will find that even the simplest objects consume resources. Moreover, once you have objects, you will inevitably think about inheritance; once inheritance is implemented, you will discover that the troubles it brings far exceed your imagination. When James, the inventor of Java, was asked what he would do first if he could redesign Java language, he said: “Remove objects!” As a married programmer with two children, I can relate. If everyone is interested, I can write another blog discussing the real differences between C++ and C.
If you have read this far and remembered nothing, just remember one thing: no one can predict the future.
“The whole world only needs five computers” – Founder of IBM
“640K memory is enough” – Founder of Microsoft
“There’s no need to use a computer at home” – Founder of DEC
If anyone tells you that C language is already obsolete, it’s best to think for yourself; if you can seek the truth, that’s great; if not, at least remain skeptical.