Friday, August 01, 2008

Why I am not a C++ programmer: ten years on.

As a far-too-full-of-myself CS undergrad, I wrote, "Many C++ critiques are available online, but none of them address what I regard as C++'s fundamental failure..." Man, it's painful linking the above. I wrote it ten years ago, as a TA for a course that had previously been taught in C++. Despite trying way too hard to project an unearned air of worldly cool, in most ways I stand by my claims. C++ is a broken notation: its attempts at being high level make it inappropriate for serious systems work, and its attempts at being low level make it even worse for applications. Incidentally, it has a truly unfortunate culture attached to it, rife with books, tutorials, even conferences which purport to be about "design," but are in fact about about "delegation," "factories," etc., and Cartesian products thereof. None for me, thanks.

Why the stroll down memory lane? Because today a coworker introduced me to Yossi Kreinin's C++ Frequently Questioned Answers. I can no longer claim that "none of [the C++ critiques online] address ... C++'s fundamental failure," as Yossi's kills them all. Folks, we are in the presence of greatness. I feel as Salieri must have upon first encountering the works of Mozart.


Blogger Preston L. Bannister said...

Not so impressed with the "FQA", myself. Yes, C++ is not Java or Lisp or ... whatever. Duh.

So what? Use the right tool for the job. C++ is a superset of C. If as a tool C fits the problem at hand, then C++ is as good or better for the same problem.

Are there parts of C++ that are not well done? Sure. Adding scarcely-tested extensions to a language during the standardization process was not a good idea. On the other hand, you do not have to use the lousy bits. If there are aspects of the language that cause you grief - then don't use 'em.

I find C++ a useful and very sharp tool for particular tasks. If you need optimal efficiency then C++ is the best tool. You do not want automatic garbage collection. You want inline functions. You want to benchmark. You want to test very carefully. You have to spend more developer time - and for some (not all!) problems this is the right tradeoff.

12:45 AM  
Blogger Keith Adams said...

That's nice. I like bikes.

Appearances not withstanding, I'm not trying to turn this blog into a "C++ r00lz/suckz" comment flamefest. C++'s sleaziness is obvious to me, and after all this time (and added sleaziness in the intervening 10 years), I'm both sure that I cannot be persuaded otherwise, and that what's left of C++'s dwindling userbase consists of dead-enders who also cannot be convinced.

I just thought that Yossi's writing is incredible, and was looking for an excuse to link the guy.

6:57 AM  

Post a Comment

<< Home