[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: C++ (was Re: interesting links)



While we're having an off-topic discussion, I'll throw in my tuppence
about C and C++.  I have written software in both languages
professionally (and personally), and during the mid/late 90's I was a
serious C++ zealot.  At that point, ANSI was still frantically trying
to actually complete the formal language and library specification,
and in the process turning up all the various ambiguities in previous
specifications and implementation bugs in all of the compilers.
Certain things in draft specifications were actually provably
impossible to implement, IIRC.  There was no compiler that was
actually correct at that point, and anyway there was no complete and
consistent specification to conform to.  Java was an obscure project
for set top boxes being worked on by some guy in some back room at
Sun; nevermind Python and Ruby.  And so despite the mess, everybody
was using C++.  (Better alternatives -- Eiffel for example -- were not
marketed well enough to get any attention.)

It was right around 1999/2000 (when I was also enthralled with CORBA
and all the wonderful things it was going to do for the world) that I
finally got seriously fed up with C++.  It is a complex, non-sensical,
twelve-headed dragon-horse-goat-chimera-frankenstein-beast designed by
committee and assembled by vandals.  It is like Perl in this regard,
but unlike Perl, it masquerades as a clean, serious language, and as
such eschews all of the various kludges and convenience features that
Perl has added to help you deal with its ugliness.  Perl is a goopy,
tacky mess of glue that you can squirt into any crevice and it will
hold everything together.  C++ is a fragile, crystalline structure
held together by tinsel and prayers.  You cannot squeeze it into the
space you need it to be in.  You have to form the space around it.

To illustrate the point, I have in my library a truly wonderful book
written around that time called "Large Scale C++ Software Design".  It
is quite a hefty book, and dense with information.  It was my bible,
and I thought it was one of the most insightful technical books I had
ever read.  Eventually I recognized that the entire book was about how
to use C++ safely -- how to avoid all the dangers and pitfalls that
attack you from every angle if you actually want to use all of the
complex features of C++.  Once I quit using C++, there were very few
insights in that book that were transferrable to any other language.
And therein lies the book's greatest lesson.

C++ was a fantasically useful stepping stone from C, to bridge C
developers into the OO world.  Objective C might be better at this; I
don't know, as I never really used it much.  C++ is quite usable if
you use it simply as "a better C", and ignore 90% of what makes it
different from C and just use the 10% that is actually an
improvement.  I am referring to basic inheritence, polymorphism, and
maybe, if you're careful, exceptions and simple templates.  The
standard library is to be avoided at all costs, along with most of the
fancier language features.

Starting a new project in C++ is a questionable move at this point.
It makes sense if you actually need high performance that can't be
squeezed out of a higher level language, and in that case you are
certainly going to be avoiding the nasty features anyway, and simply
using it as "a better C".  But C can also be a better C, if you
similarly avoid all of the things in it that are dangerous and ugly.
And if you don't need really high performance, in the modern era you
should almost always look to Python, Ruby, et al., or else just go
back to the root of all such languages, Lisp.

Admittedly, I have not done any significant amount of work in C++
since 2001-ish.  Maybe things have gotten better.  I don't
particularly care, because I don't need C++ anymore.  Who really does?


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user