Mon Oct 28 2019
Why C is so popular and still the best programming language?
Computer programming has changed a lot since the 1960's but one language has managed to stay the same through thick and thin C. When C compilers had gotten into the hands of the common man, things really exploded. At a glance, there have nothing special about C compared to Ruby or Python, but C is way more powerful than anything.
There are many programming languages, today, that allow developers to be more productive than with C for different kinds of projects. There are higher level languages that provide much larger built-in libraries that simplify working with JSON, XML, UI, web pages, client requests, database connections, media manipulation, and so on. But despite that, there are plenty of reasons to believe that C programming will remain active for a long time. Here are some reasons that C is unbeatable.
1. Portability and Efficiency -
C is almost a portable assembly language. Before C, programmers had to rely on Assembly. Assembly is no doubt a great language, but there was one drawback - it was based on system instructions differing between CPUs. When C came along, it break all the barrier. It is as close to the machine as possible while it is almost universally available for existing processor architectures. There is at least one C compiler for almost every existent architecture.
2. C has no pre-defined style -
Despite its reputation of chat-channel flame wars, the fact that C has no style guide can actually be quite good. In a sense, C teaches us to accept the fact that not the only one coding in the world. Macro naming, function naming, and data structure naming all depends on your preference of style.
3. Deterministic Usage of Resources -
Arbitrary memory address access and pointer arithmetic is an important feature that makes C a perfect fit for system programming. At the hardware/software boundary, computer systems and microcontrollers map their peripherals and I/O pins into memory addresses. System applications must read and write to those custom memory locations to communicate with the world. So C's ability to manipulate arbitrary memory addresses is imperative for system programming.
Another common language feature that system programming cannot rely on is garbage collection, or even just dynamic allocation for some embedded systems. Embedded applications are very limited in time and memory resources. They are often used for real-time systems, where a non-deterministic call to the garbage collector cannot be afforded. And if dynamic allocation cannot be used because of the lack of memory, it is very important to have other mechanisms of memory management, like placing data in custom addresses, as C pointers allow.
4. C is small and simple -
C has a very small runtime. And the memory footprint for its code is smaller than for most other languages. Since C is fully based on variables, macros, functions, and structures, there isn't all that much to it. Due to this, C has been embedded on almost any modern microprocessor, from fridges to alarm clocks. It lacks the expressivity of sophisticated OOP or functional languages, but its simplicity means it can be picked up quickly.
5. Reasons to Learn C -
C is not a hard language to learn, so all the benefits from learning it will come quite cheap. Since almost all programming languages nowadays are themselves implemented in C, knowing C basically gives you a free ticket to knowing all programming languages. It's true to say that C is very different from C++ and Objective-C, but from a learning standpoint they all aren't that far apart. Of course, C is a procedural language, which means classes and objects are non-existent compared to languages like Python, but Python's class model itself is written in C. This means that understanding C may not teach you object-oriented programming, but it will teach you how it was conceived, designed, and implemented.
6. Many Interesting Projects to Power the World -
C is the best programming language today is still the fact that it simply powers everything. From your phone to your Wifi, no other language provides the level of hardware interaction with the practicality. Many of the C projects that exist today were started decades ago.
The UNIX operating system's development started in 1969, and its code was rewritten in C in 1972. The C language was actually created to move the UNIX kernel code from assembly to a higher level language, which would do the same tasks with fewer lines of code.
Oracle database development started in 1977, and its code was rewritten from assembly to C in 1983. It became one of the most popular databases in the world.
In 1985 Windows 1.0 was released. Its kernel is mostly written in C, with some parts in assembly. Linux kernel development started in 1991, and it is also written in C. The next year, it was released under the GNU license and was used as part of the GNU Operating System. The GNU operating system itself was started using C and Lisp programming languages, so many of its components are written in C.
But C programming isn't limited to projects that started decades ago, when there weren't as many programming languages as today. Many C projects are still started today.