Bartosz Milewski, a member of the 'D' design team, wrote an article about making the programming language D even safer than it purportedly already is. He called that subset: SafeD. In the process of making D and SafeD look good, the failings of C++ were highlighted in comparison. To his credit, the author was able to list a few good features: performance, low-level access, and powerful abstractions (the latter being slighted at the same time for apparently only being useful in operating systems or large systems design).
On the other hand, it is nice to hear that whenever people feel they have to make their
language-of-choice look good, inevitably some subset of C++ comes in as a benchmark. I
include the word 'subset' on purpose. There are specialized, productive, easy to learn
languages out there. I've even used a few of them. Each of them is better than some
specific aspect of C++, but few if any, can beat C++ in many areas. Ok, maybe Lisp does
better.
B Milewski did acknowledge that "There are many other simplifications and safety
improvements over C++. Unfortunately they all come at the expense of expressive power and
performance." well said.
I used C# for a couple of years, buying into the theory that automated memory management
and suborned pointers would be a good thing for me. Ah, no. I like the ability to be able
to 'shoot myself in the foot'. Really good gun-slingers know their guns, know where to
point them, know how to maintain them, know their useful range, and clean often to ensure
good performance. Would a gunslinger hand his gun over to an acolyte for cleaning and
maintenance? The same could be said of a programmer handing over memory management and
object manipulation to some hidden behind-the-scenes mechanism which may not be optimal for
the job.
Perhaps I'm just a control freak, but I had to depart C# and return to the wild west of
C++ programming in order to feed my adrenalin requirement of walking the fine edge of
writing elegant, flexible code.
Isaac Asimov wrote a book called the End of Eternity. The moral of that story was that
if humanity is not allowed to push the boundaries, and get hurt a little in the process,
stagnation sets in. Also, the hero of the story wouldn't have been able to look off
into the sunset with the heroine at his side.
Perhaps C++ is indeed a difficult language to master. It's flexibility may
be its
undoing,
but the for the tenacious learners, it provides a high level of satisfaction for allowing
one
to
come up with good solutions for tough problems, big or small... and for being able to
devise an
appropriate solution from an excellent collection of varied tools.
Scott Meyers, in his book, Effective C++, eloquently expresses why C++ has the feel of an
elephant being touched by a number of blind men. C++ is actually a federation of
languages.
- Deep down, C++ is the structured
programming language known as C.
- C++ is C with Object Orientedness added on.
- C++ is
Generic
Programming, template metaprogramming, which is said to rarely interact with mainstream C++
programming.
- STL is a sub-language of C++ based upon algorithmic programming, as defined by
Alexander Stepanov.
In the referenced article from the last point above, a few enlightning quotations about
Stepanov's strong views of C++ strengths and weaknesses:
"STL is the result of a bacterial infection", "STL is not object oriented. I think that
object orientedness is almost as much of a hoax as Artificial Intelligence.", "Always start
with algorithms.", "Generic programming is a programming method that is based in
finding the most abstract representations of efficient algorithms", and "So far, C++ is the
best language I've discovered to say what I want to say".
O how they cling and wrangle, some who claim
For preacher and monk the honored name!
For, quarreling, each to his view they cling.
Such folk see only one side of a thing.
Jainism and Buddhism. Udana 68-69:
Parable of the Blind Men and the Elephant
For those hoping to find the perfect language, here is what
The Architect has to
say about that:
"Hope, it is the quintessential human delusion, simultaneously the source of your greatest
strength, and your greatest weakness."
Perhaps C++'s flexibility is both its greatest strength as well as its greatest weakness.