+1
As one who reviews more code than he writes, I recommend that one never
underestimate the creative ways that junior programmers will find to (ab)use
language features. IMHO the language should be ‘safe’ like C# or ‘simple’
like C. Understanding that neither of these adjectives are truisms for the
citied languages, C++ is obviously more complex than C and obviously less
safe than C# (BTW C# is also less complicated because of the restrictions on
multiple inheritance etc.). IMHO this makes C++ a poor choice for any
project that isn’t written exclusively by experts.
“Maxim S. Shatskih” wrote in message news:xxxxx@ntdev…
Amen, not just the first ones either. I have witnessed such examples. I
even
hated anything C++ for years because the people using it said they were
superior
people compared to C people. They claimed object orientation meant they
would
write code twice as fast, they would have no bugs making QA irrelevant.
Ha-ha-ha. Abused C++ makes the potential for extremely hard to find bugs,
which are much worse then most C bugs.
Also, such people (my bosses were such in early 1990ies, and so was I, we
were all young, and yes, C++ was young too) often do not understand that
C++ is a paradigm mix of OOP and ADT/metaprogramming, that some features
belong to OO and some to ADT, and mixing OO+ADT styles in the same program
produces even more mess then C’s spaghetti.
Sutter and Alexandrescu understand this well, but not all people write C++
code in conformance with their recommendations.
For instance: not all classes are suitable to be base classes (base class is
an OO notion), especially STL containers do not (STL is an ADT thing).
Beware of inheritance, it produces the fragile base class bugs which are by
far harder to fix then C-style spaghetti bugs.
And yes, people like my bosses and I in early 1990ies were writing copy
constructors with updates to the original object, implementing the B-tree
page split function as copy constructor. Yes, this is bad style.
Even here on this list somebody suggests to inherit from a template which
defines operator new/delete. Evil. For the correct way, see how std::vector
uses std::allocator.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com