C++
Posted on November 9, 2011
Filed Under Programming | Leave a Comment
Lots of people discussing C++ this week. Over at inessential he mentions how horrible C++ in. Even comparing it (gasp) to Perl.
There’s a lot to dislike about C++. But here’s the thing. You don’t need to use all its features. It’s quite possible to use C++ in a more C like fashion. Primarily leveraging simple classes as well as some of the more useful aspects of the template library such as vectors.
It seems to me that most of the annoying aspects of C++ are features more targeting library authors than regular users. Admittedly some of them (like multiple inheritance) seemed like a good idea at the time but ended up being more a cool idea rather than a solution to a real problem. (A constant problem with more theoretical aspects of languages focused on in computer science departments rather than the real work of software engineering and day to day coding)
What bugs me though is that people keep pointing to these features as if they define C++ even though I bet in most people’s day to day life they never encounter these features. Yes there are undoubtedly some sloppy programmers using these narrow esoteric features in very unwise ways. But let’s be honest, it’s not hard to find old C code with egregious use of gotos as well. Bad programmers are bad programmers. And what makes bad programmers bad is that they use some feature designed for a rare niche case and start using it everywhere rather than thinking through the problem they are attempting to solve.
The thing that to me makes a language horrible is when common use case scenarios are hard to do or hard to decipher. Personally that’s the case for me with Perl. It often seems like a language where regex is the solution to everything much like a hammer is constantly in search of a nail. And older versions of Obj-C used to bug me in that it was such a pain to read out properties. (Fortunately Apple fixed this in recent versions) About the only equivalent in C and C++ are the dreaded header files which seem more and more pointless as time goes on. (Originally they made sense in terms of how compilers used to be written)
Comments
Leave a Reply