Two perspectives on the design of C++

Here are two complementary (but not entirely complimentary!) blog posts about C++.

Roshan James has a scathing article about C++. When asked to recommend books on C++, he replied that he doesn’t recommend C++. He explains how the best C++ books may be Scott Meyer’s series Effective C++ but argues that they should be called “Defective C++. ” He isn’t criticizing Scott Meyers, only the aspects of the C++ language that made it necessary for Scott Meyers to write such books. Effective C++ explains how to get around problems that don’t exist in more recent languages.

Bruce Eckel’s article The Positive Legacy of C++ and Java focused more on what C++ did well. C++ was designed to be backwardly compatible with C. Bjarne Stroustrup, original authorĀ  of C++, realized that the decision to be compatible with C would cause major difficulties, but he also thought (correctly) that without such compatibility no one would move over to the new language. Given this severe constraint, C++ has been remarkably well designed.

Update: Check out the C++ FQA site Alessandro Gentilini mentions in the comments. “FQA” is not a typo. It stands for Frequently Questioned Answers.

8 thoughts on “Two perspectives on the design of C++

  1. Julian Smith wrote a great article explaining his own disillusionment with C++ and more. He wonders if Effective C++ is actually part of the problem.

    “To help navigate the complexity that today’s programming involves, we
    turn to books. There are some excellent ones such as Meyers’ Effective
    C++/STL that stand out amongst the rubbish that is deposited on the
    industry, but I wonder whether Meyers and others are actually doing us
    a disservice. In effect, they make it possible for us to muddle along
    with current languages and development systems when we should really be
    throwing them out and doing things properly.”

    Stroustrup’s “Design and Evolution of C++” is a truly fascinating account of the forces which have shaped C++. Probably worth holding back on getting a copy for a year or two, though: I suspect he’ll be updating it for C++0X.

  2. I’m a fan of using the language that I think is most effective for the task at hand. I’m still an advocate of C++, because it’s easy for me to write fast and efficient code. Since C++ is compatible with C, it makes it easy to write native libraries to extend the functionality of other languages (I coded a lot of JNI in my time as a software developer). C doesn’t have enough for me there, though it still is an excellent tool for kernel and driver development.

    That said, I like Java a lot for whipping something together (I understand that Python is good for this too, but I haven’t really used it yet), because of its huge API, and I use MATLAB when I want to try out something mathematical, or when I want to munch on some data. Since there are so many choices when it comes to language these days, I don’t see why criticizing C++ is even relevant anymore.

  3. I agree that there are “many choices when comes to language these days” IF you’re willing use a runtime: JVM for Java, CLR for C#, etc. But if you want to compile down to native code, the mainstream options haven’t changed in a couple decades.

  4. Right. But the other side of the coin is that nobody seems interested in improving the state of the art in that arena. All the effort seems to be going into compiler research and not into designing a better language for native code (though I’m not in PL; I could be full of it), and there are other choices, like Ada, but nobody uses them.

    Much of the complaining about C++ is either from hardcore C users or from people who don’t mind using a runtime. I’m personally not averse to having a runtime, as long as it doesn’t get in the way. I guess the point that I was trying to make is that for the majority of software, you don’t necessarily need to be super-sleek, or there are libraries that you can take advantage of that have native acceleration, so you do often have the choice.

  5. There’s certainly less need these days for the kind of efficiency C++ affords. I do a lot of numerical computing, and it’s not uncommon for a program to run for hours. But development time still exceeds execution time.

    On the other hand, I like the way MFC/C++ programs are lightening-fast compared to .NET/C# programs, especially in terms of time for the program to load.

    (By the way, the time it takes boot a computer and do other common tasks hasn’t improved in twenty years.)

  6. Re: MFC/.NET: I think that’s true. Though I have to say that MFC is nightmarish to program. It’s basically got it all wrong. A friend of mine used WTL (which was built right on top of the Win32 API), and had really good success with it. It’s just too bad that there’s no support for it.

    Re: Boot time: I think that’s another issue entirely, as you mention in your link. :-)

Comments are closed.