My personal view of C as a programming language

For some reason, as far as I can tell, people do not share their experience with, and views of, C so much. At least not in blogs. That is a bit surprising, given that Tiobe, for example, would rank it as the most popular programming language. Perhaps the typical C programmer simply isn’t very active in communities like these.

Personally I’ve been programming for… a long time, and for a large majority of that time, C has been (and still is) my favorite language. Why? Probably mainly because it is a system programming language with virtually no overhead. It’s transparent, predictable, standalone, and arguably the most performant language around. If you are able to write a stable, secure, system service in C you can leave it, come back ten years later, and it will still be there, with a minimal footprint, doing it’s job without a worry in the world.

Why not C++? To me C++ is a language of too many shapes at the same time. Most use it for it’s OOP features, but still it’s not a pure OOP language. I guess I personally feel it lacks some elegance and clarity. I know exactly what C is and isn’t. With C++, I don’t. Then again, of course there are many advantages to C++ as well.

Java? Well Java is not a system programming language, to begin with. To me the language seems better defined and more elegantly designed than C++, but I find the runtime overhead, and tendencies to create code bloat and over abstract difficult to agree with. Java was designed with simplicity in mind, but I’m not sure that’s where we ended up.

The challenges with C

The main challenge with C, I find, is it’s ecosystem, or lack thereof.

A common situation when developing in C is finding yourself in a need a basic building block that you easily find in most languages, like for example an associative array. When you do you typically have the following options:

  • Build your own, or approximation thereof, typically for yourself which means duplicating work that has been done too many times already and probably won’t end up being reused by others
  • Use your own utility libraries which means you already did the above
  • Go on the hunt for decent library, which is both stable and mature, and doesn’t carry with it too much unwanted weight

In many cases you end with working around the problem in a less than ideal way and spending a lot of time not solving the actual problem at hand. Or you end up marrying to a complex and heavy framework like Glib or the Apache APR.

Of course there exists a huge amount of C libraries but the community is not organized nor structured, and it’s difficult know what code you can trust. The lower level system programming API’s are there, mature and reliable, but the further you go from them the more you are on your own.

Can you develop modular, reusable code in C? Yes, definitely. Is it possible to use C for rapid development? Yes, when you have the basic toolsets needed. In C++ you have them, in Java, as well as and in most other languages. In C you often struggle.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s