I'm working on maintaining a piece of software that somehow survived for 15 years and was even sold, and more than that, it has production deployments which are working as of today (to clarify, I haven't written it, I was hired to maintain, bugfix, and extend it). To protect the guilty, I won't go into detail on what is that software precisely about. It would suffice to say that this software is the enterprisey type for planning some work, tracking the work being done and money to be paid for that.
Of course, such software is always a steady source of fun for everyone trying to debug it, but this software beats them all, hands down.
First, it is written in Perl. Not a WTF per se, of course, but the folks apparently were banned from reading Perl Best Practices and similar literature.
Second, also not a WTF in itself, but in 2013 it still uses plain old school CGI. Never heard of Plack, and not even FastCGI.
Third, it uses MySQL database. Not only that, but MyISAM all over. Not only that, but natural keys all over the place, so you have 111-ish tables, each using varchar(40) as primary key in the best case, compound with a few more varchar and int column in the average case. EXPLAIN shows keys with length of 192 on a normal day.
Not only that, but the Perl code doesn't trust the database to do, well, the database work. It does all aggregation by itself, giving wonderful inconsistencies customers are tired of complaining about. That's the fourth one.
Fifth: a corollary to the previous one. MySQL has DECIMAL type used for all kinds of arithmetic where some degree of precision must be guaranteed, like anything that touches monetary data. Perl's scalars do not have such feature. Thus, all aggregation done at Perl's side, storing the results being as DECIMAL kind of loses its whole point.
Sixth: not using surrogate keys shifts the task of creating unique keys to the Perl side too. The application, in turn, does no more but select max(myidxfield) and increment it. Race condition? Never heard of that.
Seventh: it uses a god object, which is the dreaded project structure, for everything. To do that, the structure is being read from the database every bloody time. Like,
select * from projects where project_id=xxxxxxx;
select * from project_sections where project_id = xxxxxxx;
(For each section)
select * from project_items where project_id=xxxxxxx and section_id=yyyyy;
(Recursively)
select * from project_sections where project_id=xxxxxxx and parent_section_id=yyyyy;
(Of course, no one gives a crap all the sections are already there from the first query)
Repeat for all 30+ dependent tables. Each time. Even if all you need is just change an item's description.
Eighth. The software has some crappy database abstraction which everything else in it is using, and which hides SQL from plain sight (constructs it itself), but of course, it cannot do joins, or aggregates, or whatever else you might think about.
Ninth. Despite the software being written for Apache, Perl, and MySQL, it was written on Windows and initial deployments were done there. As it uses XSL-FO to generate some PDFs, it thus uses some really screwed up code to call Java, which had to be fixed to be of any use on Linux. The XSLT was written so badly that only a version of fop from 2009 manages to process it, and the newer ones belly up. The copy of fop is bundled with the software, just in case.
Tenth. And of course, the payment data is calculated differently, depending on whether you want the sum of all work done, or the sum of work performed in a given month. While the result is mathematically correct, due to the fact that the rounding needs to be performed - no one wants numbers like 459872.7898 dollars on their invoice - the final result is wonderfully inconsistent with partial results. That is,
money(spring) is off by a few cents from money(March) + money(April) + money(May). And the most wonderful thing about this is that those numbers are presented on a single page. The customer sees something wrong, reaches for his copy of Excel, checks, and is, like, WTF guys are you doing?
This is the sort of bug I'm tasked with fixing, or else. Wish me luck.