Sunday, October 04, 2009

The Story of C, C++, and D

As programming languages evolves, we have seen the introduction of C++ over C. But wait, is 'evolve' the correct word to describe C++?

Choice of programming language has always been a pseudo-religious topic, proponents for language X will use only one and only one language i.e. X and the rest are either 'toy languages', or complain incessantly for the lack of features A, B, or C that exist for that particular language.

Case in point: C vs. C++, as recently someone in reddit asked about the merit of C++ in embedded systems. The result is predictable, soon the thread has been flooded with 400+ of comments, and it looks like 80% of people prefer C. C++ can only take a back seat with labels like 'obscure syntax', 'inefficient', etc. Though there are thoughtful responses, overall the discussion gives an impression a lot of language zealots who support C, never actually spend enough time to really learn C++ properly. What I mean is C++ was designed with specific design goals and problem domains in mind. If you treat C++ as a C with strong type-checking, then you (and presumably the C++ compiler) won't be too happy in the long run.

To make the matter even more fun, here comes the D language: some random reader has complimented this language on reddit and solicited for opinions. Again, language fanboys are up in arms, defend their beloved {c, c++, java, python, perl, whatever} and make their best shots to shoot down D. Personally I view D with reservations as it is still in a state of flux. Investing time and resource in an experimental language is pretty risky, let alone D is in a rather awkward position of having 2 'standard' libraries (Phobos and Tango) and two versions: D 1.0 is so-called the stable branch while D 2.0 is experimental.

For a beginner like me, I am confused. Since D 2.0 is different from the core D 1.0 language, to me learning D 1.0 doesn't really worth my time and energy. On the other hand, D 2.0 is still under development, and the best strategy is to sit and wait until there is a stable D language spec.

Ah, but don't forget C++ is also undergoing some major uplifting: the C++0x is not yet formally approved yet, therefore the 'x' denotes the year where this new spec is being approved. A lot of people think it would be 2010, so it will be C++010, or C++0xA in hex. However, C++0x so far only adds features and it doesn't have any major change that will affect the current C++ code bases.

Now, back to the question: if I want a programming language that is relatively stable and usable for my jobs on hand, what language should I turn to?

Too bad, I can only go for C. Therefore, I declare C++ sucks! D sucks! :P haha

No comments: