Linked by David Adams on Sat 11th Oct 2008 16:48 UTC, submitted by IndigoJo
General Development Eric Raymond is working on an essay, putatively titled "Why C++ Is Not My Favorite Programming Language". In his announcement, he calls it "an overcomplexity generator", "bloated, obfuscated, unwieldy, rigid, and brittle", and alleges that these characteristics appear in C++ applications also. I contend that many of the complaints about C++ are petty or are aimed at specific libraries or poor documentation and that many of the features commonly regarded as unnecessary (and excluded from intended replacements) are, in fact, highly useful. C++: the Ugly Useful Programming Language
Thread beginning with comment 333449
To view parent comment, click here.
To read all comments associated with this story, please click here.
StaubSaugerNZ
Member since:
2007-07-13

"Despite the power of C++ as a language it is weak in areas such as legibility, cross-platform standard libraries, and thread-safe programs that can be maintained by mortals (not just the 'elite' that visit sites like this). This is why C++ has been marginalized by Java and the much-simpler C (still used for systems programming).


You raise valid concerns for someone who is not using C++ day in and day out. So let me shortly address them.

* Legibility: Use only the STL and the below libraries in a procedural style way interacting with your objects/classes.

* Cross-platform standard libraries: Poco C++, Boost, SQLite, wxWidgets are very free and very commercial quality. QT is very solid as well.

* Thread-safe programs that can be maintained by mortals: This is hard in any language. The latest version of Boost is moving toward making this easier. The early years of getting our heads around Object Design was hard. Until we fully understand threading it will be hard. Don't fret because C++ will be the first to fully utilize and set the pattern for other languages in this area.

I understand the mental handicap of learning something new or just plain not liking something. But modern C++ programming from scratch (avoiding any C style thinking) is very easy to read, maintain, develop, and obtain performance to create simple or demanding applications with.

I don't wish to convert anyone only to say that it is very nice sipping the cool glass of lemonade that is C++ nowadays so don't feel sorry for us. 10 years ago... yes... maintaining someone else poor C++ style... yes that is a lot of work but not anymore with modern styles.
"

Just to make clear, I used C++ day in and day out for ten years. This is not a case of "I dipped my toes in the water but it was a bit chilly". I got fed up with the gcc and Visual C++ headers changing things (mostly slight changes to macros) around with each release - which meant you had to keep porting to new versions of the C++ compilers. I got fed up with adjusting everything so I could link alls sotrs of modules togther due to different name-mangling schemes used by different compilers. I got fed up with the compiler producing ridiculous illegible template compile error messages. I got fed up with both g++ and Microsoft having compilers that didn't conform to Standard C++. Then Microsoft declared it would never implement a 100% conforming version of C++, followed by a warping C++ with a bunch of extra crap to shim it into .NET. Once your program gets big (back then I was working on PhD thesis software was around 100k lines of C++ that took around 5 years to build and maintain) I found it just too much of a PITA.

I used to believe in C++, but now I realise simpler is better (though I'm not reductionist enough to switch to Lisp). For a long time C++ was better than Java 'cause it was smaller and a lot faster. It's only advantage these days is it has a smaller runtime footprint in many cases, but in restricted-memory (embedded) systems you have a restricted problem domain so you might as well use C instead since it is so much simpler than C++.


* Cross-platform standard libraries: Poco C++, Boost, SQLite, wxWidgets are very free and very commercial quality. QT is very solid as well.


Sorry, perhaps I wasn't clear enough in my earlier post. None of these are a part of Standard C++ so you can't guarantee they'll be available in any new C++ environment. For example, I often have to work with the endorsed tools an enterprise client has chosen, so I don't always get to use non-standard stuff - this isn't a problem with Java since it comes with a lot more stuff as standard.


Thread-safe programs that can be maintained by mortals: This is hard in any language. The latest version of Boost is moving toward making this easier. The early years of getting our heads around Object Design was hard. Until we fully understand threading it will be hard. Don't fret because C++ will be the first to fully utilize and set the pattern for other languages in this area.


From this I guess you must either be involved with Microsoft or Boost. Sorry, but your last sentence is pure marketing drivel to someone who's both the trenches and also does reconnaissance from the high ground from time to time. Until C++ sorts out automated memory management using threads will be more difficult than Java for very complex programs (where long-lived multi-threaded programs share state). Myself and my colleagues routinely write complicated multi-threaded programs in Java that would take far longer to build in C++ (mostly due to the memory debugging required under multi-threaded conditions). That reduced time means a lower cost of development to our clients, and that's what it is all about (anyone who doesn't care about cost is either not paying or considering the development bill).


I understand the mental handicap of learning something new or just plain not liking something. But modern C++ programming from scratch (avoiding any C style thinking) is very easy to read, maintain, develop, and obtain performance to create simple or demanding applications with.


Even FORTRAN is 'easy to read' if you are the only person writing the program. The more you read other people's code the more you appreciate what simplification has to offer. When I write C++ these days I use a modern style, but I find that the productivity and ease-of-development still isn't anywhere Java. I find in big projects (where I used to use C++) I'll use Java, and in small projects I'll use C. For me, despite the years of investment in the language, C++ just doesn't pull its weight anymore. I think that's why there has been a move away from it (not because developers are unaware of its features).

C++ is good if you like more features. It'll let you get from A to B when few other languages can, but you have to walk a tightrope to get there. Java is good if you see greater elegance in simplicity (same as Zune vs iPod/iPhone I guess).

Thanks for taking the time to respond.

Albert Einstein:
Make everything as simple as possible, but not simpler.

Reply Parent Score: 3

luzr Member since:
2005-11-20


Until C++ sorts out automated memory management using threads will be more difficult than Java for very complex programs (where long-lived multi-threaded programs share state).


If you still have to care about memory management in C++, you are doing something wrong...

If your C++ code has more than one delete per ten thousand lines and more than one new per two thousand lines, you still have something to learn ;)

Anyway, C++ has one major disadvantage. As it is around for a long time and as it has more than single vendor (unlike Java and C#), there have emerged many ways how to do C++ code.

That is why I keep saying that people should rather compare Java/C# to Qt/wxWidgets/U++ etc... than to C++.

I also believe that C++ standard library (and particulary STL) is way suboptimal. It makes you wish C++ had garbage collector...

Used properly, C++ can beat just about everything in runtime performance and in productivity IN THE SAME TIME. It is like free lunch. Of course, you need to invest in the steep learning curve to get there..

(A bit of self-promotion, I believe that these examples nicely demonstrate this:

http://www.ultimatepp.org/www$uppweb$comparison$en-us.html
)

Reply Parent Score: 3