I am working with a special-purpose database. It has no SQL interface, so if you wan to use it from your application, you have to build the query with objects, with code like query.addFilter(new AttributeFilter("value", "GT", "1.0"))
, which can be pretty annoying. There is also a GUI where you can enter a query string, which is basically a string representation of the query objects. It requires a lot of brackets and quotes and isn't very robust, but it gets the job done.
Once, I added a feature to this DB and wanted to add some automated tests for it, so I looked into the test suite. I found that many tests use the same type of query string that you can use in the GUI, and that they all extend a common TestCase base class where the string is parsed and to create the query objects. Because the test framework is a hole WTF by itself and I couldn't get my test to run, I added some logging statements to the TestCase base class, to see if it even tries to run my test.
At this point, I got interrupted by a coworker who had some problems. So we opened up the GUI and ran some queries. After that, I noticed that the log was full with my debug stuff. A bit of poking around confirmed:
Every time you run a query from the GUI, a new TestCase instance is created to parse and execute the Query.
The real WTF is that this is quite representative for the overall quality of the architecture.