4 ms·
In my experience there's only 3 major C++ styles: BusinessObjects *(Java-ish Qt), std::cavedwelling<stl_guru, guru_cavedwelling_tag<const _Type<T &> >::const_va
by hosay123 14y ago
In my experience there's only 3 major C++ styles: BusinessObjects *(Java-ish Qt), std::cavedwelling<stl_guru, guru_cavedwelling_tag<const _Type<T &> >::const_value_type, and void _rather_be_writing_c();
Often code you'll come across is some combobulated identity crisis mixture of those 3. In terms of sheer readability and extension, I'm a major fan of Qt's design style (their most elaborate use of C++ appears to be virtual functions and the pImpl idiom), although that approach leads to heavy heap usage.
Really detest simple problems "overly" expressed in guru-ified STL. Can't read it, can't modify it, can't extend it, can't debug it. Naturally this means I'm not a great fan of Boost.
- eropple 14y agoCan't read it, can't modify it, can't extend it, can't debug it. Naturally this means I'm not a great fan of Boost. The STL in particular is designed the way it is largely for performance reasons. Ditto for Boost. I am not a fan of writing template soup, but theirs has a purpose. I mean, it can totally be frustrating (the inheritance hierarchy for collections/iterators recently gave me grief), but the reasons for their design decisions, when you take into account their goals, are generally very sound. In any event, I have never had to introduce template soup to my code when using Boost. Even the boilerplate annoyances have been largely mitigated with C++11 and type inference.
- cageface 14y agoI can see why Stroustrup finds so much C++ criticism annoying - language design is all about tradeoffs and many of the less elegant parts of C++ are compromises made to preserve performance. Stroustrup himself has said there's a cleaner, simpler language trying to get out of C++. C++11 seems like a good step in that direction.
- emmelaich 14y agoIndeed. Not only that, the criticisms are often poor echoes of Stroustrup's own considered, well presented discussion of shortcomings and trade-offs as presented in say, "The Design and Evolution of C++"
- ___1___ 14y agoC++ is a multiparadigm language, all of the styles you mention are extreme bastardisations of the style laid out in books like Accelerated C++, Effective C++, Exceptional C++. Modern C++ Design and so on. That style tends to be similar to that used in the STL with some OOP thrown in - when suitable. It is about selecting the abstraction that is appropriately ensuring the code is abides by RAII. I am convinced that the Javaish/Qt way of coding is destructive for C++ as inheritance is not as simple as the generic programming style once you get to grips with it and has a lot of gotchas. And the C - style is to me just plain wrong, especially if you are using any of the C++ standard library as they are privy to throw and without reliance on RAII your code will not be exception safe, if you want C use C.
- api 14y ago"std::cavedwelling<stl_guru, guru_cavedwelling_tag<const _Type<T &> >::const_value_type" Pure gold.