I just ran across a posting on Reddit which certainly caught my attention because it discuses the merits of C versus C++. It also revealing about a major player in software development:
On Wed, 5 Sep 2007, Dmitry Kakurin wrote:
>
> When I first looked at Git source code two things struck me as odd:
> 1. Pure C as opposed to C++. No idea why. Please don’t talk about portability,
> it’s BS.*YOU* are full of bullshit.
C++ is a horrible language. It’s made more horrible by the fact that a lot
of substandard programmers use it, to the point where it’s much much
easier to generate total and utter crap with it. Quite frankly, even if
the choice of C were to do *nothing* but keep the C++ programmers out,
that in itself would be a huge reason to use C.In other words: the choice of C is the only sane choice. I know Miles
Bader jokingly said “to piss you off”, but it’s actually true. I’ve come
to the conclusion that any programmer that would prefer the project to be
in C++ over C is likely a programmer that I really *would* prefer to piss
off, so that he doesn’t come and screw up any project I’m involved with.C++ leads to really really bad design choices. You invariably start using
the “nice” library features of the language like STL and Boost and other
total and utter crap, that may “help” you program, but causes:– infinite amounts of pain when they don’t work (and anybody who tells me
that STL and especially Boost are stable and portable is just so full
of BS that it’s not even funny)– inefficient abstracted programming models where two years down the road
you notice that some abstraction wasn’t very efficient, but now all
your code depends on all the nice object models around it, and you
cannot fix it without rewriting your app.In other words, the only way to do good, efficient, and system-level and
portable C++ ends up to limit yourself to all the things that are
basically available in C.
Linus Torvalds
Now ye Editor has worked with both C and C++ but not in a long time other than some small C projects. But ye Editor can verify that some of the refactorings in C++ required to adopt object models that were well short of the required project needs – these were extremely painful and eventually ended up in a completely new modeling and rewrite. So one personal episode can confirm one of Linus objections.
And in Debian benchmarks of the languages, C and C++ vie for the top of the performance heap most of the time; but as the benchmarkers note – it is hard to pick your poison. Personally ye Editor has become a Java, JavaScript, and PHP kind of coder – but that is because of the kind of development done – Web mostly.
So maybe there is truth to the idea that choice of programming language is dependent on the project and purpose of the program. Having learned over 20 languages in the course an IT career ye Editor finds himself reverting to that which works most agilely – that is what allows one to deliver working code that is reliable+performant and can be adapted quickly to the clients oft-changing requirements.
I would say it depends on the environment the program will eventually run in and once that is known your choices are very limited. You can’t really convince a client to change to a new environment or invest in new hardware.