Monday, January 7, 2013

C as King of the Programming Languages

Disclaimer: I've always been a fan of the C programming language.  I adore the power and flexibility it has always afforded me, the programmer.

I was a bit surprised at first to see that C ranked #1 in 2012 according to TIOBE.

Then it kind of dawned on me that C was one of the major languages involved with smartphone and tablet development, and that seems to be the hot topic of the day.  For iOS, we have Apple's flavor of C in the form of Objective-C (which takes a while to get use to for the uninitiated) which rose sharply as well giving credit to this theory (since Obj-C really has no other use aside from Apple specific solutions).

Java was hogging the top spot for a while, but it was refreshing to see C going in and out of the #1 spot since at least 1988 according to:

So, why is this so?  As a software guy, I've always been told that everyone should be using Java, C# or other "managed" languages.  Object-Oriented is *THE* way to go and that's that.  Dynamic typing, garbage collection, and other things are stuff we should want...

Yet, C somehow retains its value?  How and why?

In one of my more subjective rants, I'll say that it is because C let's the programmer be a programmer.  People don't have to learn assembly (though it never hurts of course) and still have platform agnostic source code all while cranking out amazingly optimized (or disastrous) binaries.

It is not for the feint of heart.  Many trivial things need solutions done over and over again.  C taught me lessons constantly that almost always showed that any "general solution" to a problem will be slower than a meticulously crafted one for whatever we're doing.  C gives me this power for better or for worse.

Of course, C can be quite cryptic, excessive, and takes a long time to go from design to solution (usually), and in general, it requires a more skilled and competent developer to actually make a program to solve some problem.  All these things usually mean more money and time invested from a business perspective, so I can understand why the push and drive for "easier" languages has been around for a while.

Don't get me wrong, I like Java and C# as well for what they are, but I would never give a blanket statement that one language is the end all be all answer to everything.

For a binary distribution where performance is needed, C definitely ranks in my top recommended answers.  At the same time, if you have a program that needs to work on multiple platforms, C is well adopted across many platforms and should allow porting with few issues (though when porting issues do come up, they can get complicated).

Languages like Java tried to solve this exact platform portability problem with the idea that you "compile once, run anywhere" (among other things).

Each language has its ups and downs given some situation.  For things like games, I can't recommend enough using C and/or C++.  These languages will *allow* a competent programmer to deploy a well crafted, albeit probably complex, solution.  Will there be problems?  Well, of course!

The *potential* for great software exists with C/C++, but the real issue here is whether a company thinks it is really worth shelling out a substantially larger amount of money for a good programmer just for a chance to make their software run xx% better/faster than some other "easier" language that probably could be deployed in a much faster timeframe.

As a programmer myself, this potential I mentioned is why C should remain king for a long time.  It allows me the ability to do what I want to do and what I can do in to one volatile package.  The learning curve can be steep, and it will force a developer sooner or later to learn more about how CPU's and computers actually work, but this will make them better at their craft at the end of the day.

I may blog more about specifics of this later.

No comments:

Post a Comment