Thomas Hruska wrote: > http://cubicspot.blogspot.com/2007/09/standards-documentation-is-annoying.html >
I think one of the problems with the C++ Standard Library is that as a whole it delegates to the C Standard Library and adds classes primarily in the STL and I/O modules. At least those are the two areas where people are most likely to use classes, as functors are a mystery to most beginners. I think the C++ standard should list more interfaces. I have always been a fan of the design pattern where you always code to an interface, and leave the implementation to the user of your code. In some cases this may require the use of factories, which can be tedious, but in general that is not required. What it does mean, however, is that people can extend the framework (be it a standard framework or third party) with their own objects and still interact with code written to adhere to the official standard. You get the best of both worlds -- a well-defined standard interface objects can use to interact, without burdening users of the framework by requiring specific implementations. Sure, the official standard could provide a reference implementation, but compiler publishers would be free to provide their own implementations in place of or in addition to the reference implementation. I love how in Java I can code to Collections interfaces, yet either subclass the JFC (Java Foundation Classes, the equivalent to the C++ Standard Library) classes to do my bidding, or just code a whole new one to the same interface. At times I have done just that, because I needed a highly specialized data structure that was required to work with thousands of lines of code already written to the JFC interfaces. -- John Gaughan
