In answer to a Quora question about the weirdest bit of code nobody touched because it just worked, I posted this answer:
Want to hear a real doozy?
I've been on this massive project for the past two years that has been around since the early 2000's. I haven't counted the lines but a million lines wouldn't surprise me. Half of it is in C++ using COM, and the other half is in C#. Most of it suffers from “written by old school C experts" syndrome.
There's a critical portion of the project that was originally created in a model based software engineering tool from the early 2000’s. One of the early attempts at “no code” development. Even then it couldn't be used in conjunction with the project, so it had to be exported.
And here's where it should probably offend your engineering sensibilities. Stop reading now if you're easily offended.
See, the only way this model based code could export to something else was as an SQL file, which file doesn't even define table relationships. It's well over 100,000 lines of SQL with no indication of how anything is related to other things.
And then that gets converted to C++ code through a Perl script.
Yep.
Not a joke.
Model based thing → SQL file → Perl script translation → C++.
The script takes like 20 minutes to run.
It worked. Nobody understood how. And sometimes things didn't work quite right, but since nobody could really touch any of that stuff, anything that didn't work right was “fixed" at a higher level. Duct tape solutions.
I had a budget of about a month's worth of time just for me to modernize it so it wouldn't be “nobody touches this" anymore. I was going through a whole lot of stuff in my personal life at the same time. I managed to first untangle the SQL and extract some meaning out of it, then put together a utility (not a script!) that could consume the SQL file and translate it into C#. I got about 90% there, with some of the syntax not quite matching up well enough to compile. But hey, it has a fully integrated build process and it only takes about 10 seconds to translate, so it would also come with the ancillary benefit of being able to stop using a Python script to build the project as it could all be done with MSBuild. Yup, Python script invokes Perl script to translate before invoking all the separate builds in the project.
So there it sits. This hideous monster that nobody dares to touch, but which the entire project depends on.
True story, not a joke.
And everybody bitches about the Python script to build the project, but at least that's maintained.