|
Re: Elegance and Other Design Ideals
|
Posted: Feb 26, 2004 11:20 AM
|
|
> Base on what I've heard people complains about C++, I > strongly believe you need more than these two evidences to > convince your fact.
There's a comparison of how to print out 99 bottles of beer on the wall in 621 languages. Appropriately enough, it has several different versions of C++ program, each with in a different style. The length varies widely:
http://99-bottles-of-beer.ls-la.net/c.html
When Bjarne made the claim in the interview, I imagined him to be talking more about algorithms than program infrastructure. Bjarne, you can correct me if I was wrong about that. So for example, looking at what code -- the while loops and for loops and data structures -- it would take to implement an algorithm that does something specific. Not the access specifiers and object infrastructure you might want to put around that algorithm if it were to be part of a large system.
I can't remember who said this and in what context, but somewhere I heard someone talking about how it is ironic that the bigger the language, the smaller the code in that language. In other words, the more features a language has in it, the more ways a programmer can say what needs to be said -- including possibly a very succinct way -- so and the smaller the programmer can make the code. I thought it was Matz who said this about Ruby in his interview, but I can't find it. Regardless, C++ has a lot of features, and perhaps that helps make code shorter.
After one of Bjarne's talks at the JAOO conference where we did the interview, someone in the audience asked Bjarne about readability. And Bjarne's answer was that many people confuse readability with familiarity. It occurred to me that if you handed both me and Bjarne a book written in Danish and a C++ program, I would find both much harder to read than Bjarne. I think that different languages kind of aim at a different level of familiarity than others, so that's another factor in play. Languages that enable more terse code probably also assume the readers of the code are going to have spent more effort becoming familiar with all the various aspects of the language.
I'm curious, Bjarne, if you were talking about C++ compared to scripting languages like Ruby and Python and Perl, or just C++ compared to systems languages like Java and C# and Eiffel. And if it is more about comparing just the algorithms versus an entire application. Because my experience is that at the application level, Java was less verbose than C++, and Python is less verbose than Java. Although in Python I tend to write in a structured design style, not an OO style, so it is kind of an apples to oranges comparison. Whereas I have built the same kind of OO sytems in Java that I used to do in C++. That said, I was programming in C++ long before the STL, so I was not using a modern C++ style.
|
|