In this blog, I want to talk about ‘the good’ and ‘the bad’ of C and will leave you to decide what aspects of the programme are ‘the ugly’.
The Good — Building Block 🧱
This may not be so much of a direct benefit but I wanted to include this as it shows the foundations of programming. C is considered to be the most fundamental language because many programming languages such as Python, C++, Java, etc are built with the base of the C language. Knowing this, it can help you to learn other programmes easily when it comes to syntax and functions.
The Good — Power & Efficiency 💪🏽
C is a robust language because it has many data types and operators to give you a flexible and broad platform to perform all kinds of operations and functions.
The Good — Portable 📱
C is known to be machine independent or, in other words, flexible because it helps you to run your code on any machine without making any change or just a few changes in the code. Now, isn’t that convenient!?
The Good — Structure and Extension 🤝🏽
C is structure-based meaning that the issues or complex problems are divided into smaller blocks or functions. This helps in easier and simpler testing and maintenance.
Another important ability of C is to extend itself as it has its own set of library. So, it becomes easy to use these functions and we can add our own functions to the C Standard Library and make code simpler.
The Good — Complexity ➕✖️➗➖
C has made program computations very fast and smooth with the use of algorithms and data structures. Thus, the C language can be used in complex calculations and operations such as MATLAB.
The Good — Dynamic Memory Allocation 🧠
C allows for dynamic memory allocation which means you can freely allocate memory at run time. For example, if you aren’t aware of how much memory is required by objects in your program, you can still run a program in C and assign the memory at the same time. I have also written a blog on memory allocation in C which you can read here!
The Bad — No OOP 🚫
Although C is a very vast language, it does not support the concept of OOP but simply follows the procedural programming approach.
The Bad — Error Checking 🪲
When writing programmes, errors or bugs aren’t detected after each line of code. The compiler shows all errors after writing the program and this makes the checking of code very complex in large programs.
The Bad — Exception Handling 🔬
Exception Handling is one of the most important features of programming languages but C does not manifest this feature. While compiling the code, various issues and bugs can occur and Exception Handling allows you to catch the error and take appropriate responses but this isn’t the case in C.
The Bad — Low Level of Abstraction 🧩
Opinions are mixed on this one! Some consider C as a small and core machine language that has minimum data hiding and exclusive visibility that affects the security of this language. Also, low level programming has very little abstraction — you’re writing code much more closely to the computer.
I hope these different aspects of C help you see the pros and cons of the programming language and that you have decided on what you may consider as ‘the ugly’ of C!