DEV Community

Cover image for Why start learning programming with C
skillcombo
skillcombo

Posted on

Why start learning programming with C

#c

There are more and more programming languages. There are now around 700 of them. However, developers mostly use 20 of them. Here, as in many other areas, there are ratings, trends and even fashions.

Let's name some popular languages at a glance. For Enterprise development, Java (Kotlin will soon gain a foothold there as well), C#, for Web development - JavaScript, Go, Python and PHP, for mobile development - Swift, Java/Kotlin, and I dare say JavaScript (because it can, because React Native). Game developers often use C# and C++. All of them are in demand for several reasons:

simplified syntax (for the most part) and clear semantics - against the background of C;
full-featured set of standard APIs;
active community support;
A growing ecosystem of frameworks and libraries.

The C language is used in the development of hardware and software solutions. C can also be used to partially implement the functionality of performance-demanding software products. Although not every programmer is willing and able to work on such projects. But let's return to the learning stage.

Usually future developers begin programming at school, university or on courses for changing jobs. The latter option, by the way, is now very popular.

Sooner or later they ask themselves a question: what programming language is better to learn first? At school and university this question can be answered for you: most often they start with C/C++ (that's right, with a "/"). But at alternative training sites too, hardly anyone will offer you just to learn C to broaden your horizons or pump your brains. Everyone wants to get into IT quickly, so to speak. So as you can see, here and there you'll need to be at your own pace if you decide to start learning C. This platform will help to find online courses , if you want to study online.

C allows you to touch "low-level" programming

Modern high-level languages (Python, C#, Java or whatever you like) are comfortable to write in. However, these languages are very limited in their interaction with the hardware. In other words, you won't get the full experience of interacting with the hardware until you start programming in C. Modern programming languages hide hardware-dependent implementation details and instead emulate an abstraction. In most cases it is created using a virtual machine.

Unfortunately, beginners have no idea at all about memory management, file handling and code optimization because they have never seen even examples of "low-level" C programming. From this point of view modern programming languages automate and hide too much. The C language forces you to do a lot by hand and write highly optimised code.

To my mind, this is something every professional developer should try. Well, a backender at least.

C teaches freedom and responsibility

When a programming language offers a set of human-friendly abstractions, it becomes less flexible. Each built-in or library method acts as a rigidly programmed black box. In other words, modern programming languages hide implementation details and invite the developer to simply refer to a set of interfaces. Manual management of dynamic memory allocation in modern programming languages is not possible in most cases. Meanwhile, C gives you real freedom, allowing you to choose how to implement it at a lower level.

C compilers, when optimized properly, produce incredibly fast assembler code. True, in addition to checking the right optimization boxes for compilation, you have to write high-performance source code yourself. In C, we must carefully declare variables, allocate and timely clear memory, access resources and remember to release them. If C was your first language, you will get used to rational use of memory and resources, and you will get used to choosing the best possible data structures. It's a habit that will stick with you as you begin to write other languages.

C motivates you to write clean code

Unlike modern programming languages, you will have to write several times as much code to accomplish the same thing in C. This is because in C you have to implement many things at a lower level, rather than using built-in wrappers and abstractions from standard libraries which hide implementation details. When the number of lines in the code increases, the complexity of the code also increases. To compensate for this effect and keep your project in order, you should try to write clean and clear code.

Writing clean code is a skill that is particularly desirable in large commercial projects. If you learn how to write clean code in C, you will find it easier to do so in another, simpler language.

Not convinced yet?

With the rapid development of C++, C is no longer perceived by many as a language in its own right. It's as if it has become a subset of C++. Clearly, in fact, this is not the case. Indeed, C++ is a modern programming language with a full-featured set of standard libraries. In my opinion, C++ should not be the first language to learn. There is one caveat though: if you want to specialise in it in the future, go for it. In this case, the two languages can be learned in parallel, but they will "cross over" at some point - and the transition from C to C++ will be organic and almost instantaneous.

Almost all modern programming languages compete with each other, introducing new syntax, semantics and extending standard libraries and frameworks. As the saying goes, everything is for the people. That's the payoff. But if future developers start learning these languages from scratch, they will miss out on the valuable opportunities that C provides. At some point, they simply won't be able to take a new step in their development without knowing how code works at a lower level, without even knowing how their favourite frameworks and libraries are implemented internally.

So choose C as your first programming language. It will take longer to learn, but it will help you quickly become an expert in more modern languages.

Top comments (0)