|
Re: Modern C++ Style
|
Posted: Nov 25, 2003 9:51 PM
|
|
Thanks, I enjoyed this part of the interview.
I'd like to bring up a couple of points. First, regarding interfaces, Bjarne mentioned that C++ has supported interfaces all along, and he later supported his inclusion of features like multiple inheritance with the argument that, to paraphrase, "Sure, we can simulate this using other features, but sometimes it's nice to have the real thing." It seems like Java has done just that, by making "interface" a language construct; why has C++ not done the same?
The term "multiparadigm" is an interesting one. It reminds me of Larry Wall's definition of "postmodernism" as applied to programming languages. By his analogy, some languages are "modern", by stressing a particular idea, paradigm, or software model at the expense of (all) others. The "postmodern" language refuses to play favorites, and instead caters to multiple styles.
Besides C++ (and Perl, of course), another language I see as being somewhat postmodern is Python, because it supports object-oriented programming but does not try to kill procedural or (though this is debatable) functional programming. By supporting first-class, top-level functions, bound methods, and modules as namespaces for both classes and procedures, Python seems to encourage or at least permit a mixing of styles, rather than trying to be pure-OO. I find this ironic because the Python community lately has become rather purist about the Python way, but nonetheless I appreciate that Python allows me to express ideas embodied by multiple paradigms without getting in my way too much, and I appreciate this same quality in C++.
Bjarne said the following, which made me laugh to myself: Object-oriented programming is where you use class hierarchies, as first done by Simula.
I found this amusing because when I was in college, this statement would have gone without protest. Today, many OO practitioners strongly favor composition and delegance over inheritance and class hierarchies. Systems built using shallow hierarchies, compositional semantics, and reflective and dynamic relationships still seem very OO to me. On the other hand, I have a hard time defining OO anymore, and an even harder time finding public consensus.
Perhaps Simula (and Smalltalk) are representative of what OO was, in its earlier days, but there are many different, sometimes contradictory views on what OO is today. If we apply the same modern/postmodern criteria, it seems like OO is not modern itself, but that there are many subcategories of OO that exhibit modernist characteristics. For instance, design-by-contract, class-based, prototype-based, statically-typed OO, dynamically-typed OO, and so on.
C++ clearly supports some of these paradigms (sub-paradigms?) better than others. Even the so-called "multiparadigm" languages have significant tradeoffs to make.
So long, and thanks to Bill and Bjarne (and the rest of the language designers) for a fascinating series of articles.
Dave
|
|