I have to share what happened to me today.
But, first, a Meyers’ quote from “Effective STL”:
“… in the nearly 30 years I’ve been programming, I’ve never seen anything like STL. You probably haven’t either.”
Now my story:
I’m developing this app on top of an old DB which is, well, full of data we can’t afford to lose and not from the best design school, to put it mildly. So I end up wrestling this mammoth query, joining across five tables, doing unions, morphing and shaping where clauses, desperately trying to get the right result set and plug all the holes in SQL statement like Scrat water holes in Ice Age 2 (see attached picture for description ). When I finally think I’m done with the query, test points out a flaw. Due to limitation of MS Access (I know, it should be migrated to something decent, but it can’t be at this time. Period.) SQL dialect, there’s no remedy in SQL. So, I have to resort to some sort of “massaging” the data after it is fetched from the database. So I write a filter – iterator loop on the result set vector (it was meant to be a read-only query), run the thing and it runs – forever. I mean, a little shorter than that, but far from acceptable – on the order of one to two minutes. Scratch, scratch – clearly all clues point to std::vector, which shines in push_back-ing, but erasing from the middle of vector of few thousand 16-type Tuples … you get the picture. And then the light bulb comes on – std::list is the answer to my troubles. But, oh my – there’s no Extraction for std::list in PocoData. So, I fire the PocoData project, not really believing I’ll get away just like that, you know – there must be a catch, Murphy and all, but anyway, I’ve tried crazier things before … so I:
1) copy/paste std::vector Extraction template specialization
2) replace std::vector with std::list in both Extraction.h and my code
3) Recompile everything (with my eyes shut and ears covered )
4) Fire up the app and – boom! – the correct result set displays right in front of me in a fraction of second
Well, there is no comment needed to the above. I’m still rubbing my eyes and thinking, there must be a catch somewhere, but the stopwatch proves me wrong. No catch. It really was that simple.
If someone has seen anything like STL, please let me know. Because I haven’t.
Does your development look like this? Consider POCO!