10 C++ The COBOL of the 90s Q. Where did the names “C” and “C++” come from? A. They were grades. —Jerry Leichter It was perhaps inevitable that out of the Unix philosophy of not ever mak- ing anything easy for the user would come a language like C++. The idea of object-oriented programming dates back to Simula in the 60s, hitting the big time with Smalltalk in the early 70s. Other books can tell you how using any of dozens of object-oriented languages can make pro- grammers more productive, make code more robust, and reduce mainte- nance costs. Don’t expect to see any of these advantages in C++. That’s because C++ misses the point of what being object-oriented was all about. Instead of simplifying things, C++ sets a new world record for com- plexity. Like Unix, C++ was never designed, it mutated as one goofy mis- take after another became obvious. It’s just one big mess of afterthoughts. There is no grammar specifying the language (something practically all other languages have), so you can’t even tell when a given line of code is legitimate or not.
204 C++ Comparing C++ to COBOL is unfair to COBOL, which actually was a marvelous feat of engineering, given the technology of its day. The only marvelous thing about C++ is that anyone manages to get any work done in it at all. Fortunately, most good programmers know that they can avoid C++ by writing largely in C, steering clear of most of the ridiculous fea- tures that they’ll probably never understand anyway. Usually, this means writing their own non-object-oriented tools to get just the features they need. Of course, this means their code will be idiosyncratic, incompatible, and impossible to understand or reuse. But a thin veneer of C++ here and there is just enough to fool managers into approving their projects. Companies that are now desperate to rid themselves of the tangled, unread- able, patchwork messes of COBOL legacy code are in for a nasty shock. The ones who have already switched to C++ are only just starting to realize that the payoffs just aren’t there. Of course, it’s already too late. The seeds of software disasters for decades to come have already been planted and well fertilized. The Assembly Language of Object-Oriented Programming There’s nothing high-level about C++. To see why, let us look at the prop- erties of a true high-level language: Elegance: there is a simple, easily understood relationship between the notation used by a high-level language and the concepts expressed. Abstraction: each expression in a high-level language describes one and only one concept. Concepts may be described independently and combined freely. Power: with a high-level language, any precise and complete description of the desired behavior of a program may be expressed straightforwardly in that language. A high-level language lets programmers express solutions in a manner appropriate to the problem. High-level programs are relatively easy to maintain because their intent is clear. From one piece of high-level source code, modern compilers can generate very efficient code for a wide variety of platforms, so high-level code is naturally very portable and reusable.
Previous Page Next Page