r/programming • u/SunnyKatt • Sep 05 '26
There's No Limit to How Bad Code Can Get
https://zachkehs.com/blog/theres_no_limit_to_how_bad_code_can_get/
575
Upvotes
r/programming • u/SunnyKatt • Sep 05 '26
49
u/pip25hu Sep 05 '26
There are exceptions to this rule: external factors may render the software wholly inoperable if certain types of technical debt are ignored too long.
Our company has an internal system people access via a webapp. The first web UI for that system was implemented over a decade ago in JSF (Richfaces). Thankfully, we realized it would not be sustainable long-term, so we eventually created a second, SPA-based UI - a good thing, because the JSF one simply no longer works on today's browsers, its component libraries becoming unsupported long ago. If we moved too late, for most intents and purposes the software would have ceased to function - the ship would have sunk.
58
u/SoPoOneO Sep 05 '26 edited Sep 05 '26
I’m just past being an in-the-trenches dev. Everywhere is this failure to “account” for tech dept the way we would monetary dept. It’s a scourge. So I could not agree more with the thrust of this article.
But I have to say, once you’re talking to execs, bringing up Amazon as an example of how “not to do things” will instantly discredit you. Because that is what they all aspire to.
378
u/wknight8111 Sep 05 '26
I've worked on a lot of codebases in my career. Some of them have been "fine" for the most part, but some of them have been absolutely heinous.
Some of the most memorable bad code I have seen were the ones written by unsupervised junior developers or hobbiest developers (before the company hired someo "real" experienced devs to take over) and one that was written by a bargain-basement offshore contractor with zero onshore oversight.
Tech Debt is a real thing and it has several causes:
In my experience you make code better in small steps. Every time you fix a bug, do a little cleanup of the surrounding code. Every time you implement a new feature do a little refactoring to make the code more comfortable and more consistent. Every single Pull Request you open should include some kind of Tech Debt paydown, even if it's just a small amount. If you do this in your own work and start to expect it from the rest of your team, even the worst systems can be salvaged in short order without any additional time or cost.
95
u/holyknight00 Sep 05 '26
I know. I've seen that, and I've been there. And way before AI.
Companies with thousands of employees are relying on crappy company software that an intern and a dude stitched together in 6 months, and no one is able to make it work properly. Now it's too widely used to even be refactored, so all the budget is used in adding more bandaids to the big beast anytime something fails and breaks down.
18
u/qlnufy Sep 05 '26
"haunted graveyards" is so apt.
10
u/sickcodebruh420 Sep 06 '26
AI can make incredible contributions to tech debt. I inherited a system that was vibe coded by very smart non-engineers. They built something genuinely cool that the business was using to make money but they never once looked at the code, considered architecture, or even worried about putting it on a server since they could run it on their laptops. It was like how civilizations get built on top of older civilizations and they don’t realize what’s under their feet. Layers and layers of tech debt, rules that modify rules that combine with rules to get output that feeds into more rules that make the whole system work. Like a Rube Goldberg machine of code. It’s remarkable and horrible.
I’ve been chipping away at it and I’m proud of how it’s turned around. Lots of precedent cleaned up and trash removed. New features go in faster and with more confidence. What’s crazy though is how much work it still takes. It’s almost like architecture choices matter, even when AI is writing the code, and you can’t totally give up control of how your system is put together and hope to keep velocity and correctness and happiness high.
19
u/tallgrasshead Sep 05 '26
I remember seeing a phrase in a white paper from pre-internet days from the White Sands Missile Base - the public part - about writing computer programs and one statement stuck with me: "Software is the most tractable of mediums."
The last time anyone bought a ticket from a major airline ticket reseller, most likely it was on the USAS software written in 1969. I heard rumors it had been rewritten from COBOL into Java, and then I saw a product being rolled out from Sabre, one of the largest resellers of ticket booking services. I was familiar with online database coding in COBOL on Unisys mainframes using a frontend tool call "SCOP". What I saw in a browser was recognizable to me as a uniscope terminal emulator displaying a SCOP screen. I had built them and dealt with uniscope terminals often enough to know.
A few years later I was tossing a few back at a party with someone in upper management at Unisys, and related a meeting I was in watching someone try to explain the Internet to Unisys "C" level executives and their utter confusion. He concurred that the only thing going on at Unisys was keep the 1969 COBOL code up and running and people went home using Facebook and Instagram, but at work the Internet didn't exist as anything anyone cared about. They would hire grads and train them in both COBOL and the codebase.
My take is that not only is there no limit on how bad code can get and still work, but code seldom dies. I'm trying to decomm old APIs at work, and it's nearly impossible because other complex coding efforts depend on them. So I write a replacement and it doesn't replace old code - it just adds to what has to be supported.
26
u/Riki_was_here Sep 05 '26
AI is just magnifying what was happening long before. 10x devs are more productive, average joe produces 10x more slop code. Future is bleak
14
u/evolveKyro Sep 05 '26 edited Sep 05 '26
The worst code I've ever seen was at the core of one of the largest logistics organization in the world (fun fact. Amazon, DHL, FedEx aren't even in the top 10).
This was code that authorized 10+ billion dollar shipments/journeys, a during covid there were multiple 100+ billion dollar contracts. All being controlled via a custom text format coerced into Xml, stored in Sql Server using C# code that went out of its way to abstract nearly every .NET framework function.
You want to convert from a string to int ?
You want to build an array of strings?
What did any of these actually do? Just internally call the framework provided functions.
Other strange "rules" such as:
No interfaces or abstractions, everything must be a concrete sealed type, which lead to cases where you would see a class with a function, having a comment saying where it was copied from.
sealed MyClass { private string ConvertSomething() { } } sealed MyOtherClass { private string ConvertSomething() { //copied directly from MyClass.ConvertSomething, } }
6
u/fforw Sep 06 '26
The term "technical debt" makes the money people think they can treat it like any other debt, which can even be good for a company.
It's more like naked short-selling. You know there's tremendous risk that only gets larger, but you don't know when it's due and you don't know how expensive it can get.
It's a lot scarier than a bit of debt.
6
u/psyyduck Sep 05 '26
The author occasionally touches on what is really going on, yet somehow still misses it
I call it mortgage-driven-development.
3
u/MrPhi Sep 06 '26
If there is a limit, AI will find it.
3
u/Nullberri Sep 06 '26
at some point it stops compiling. so there is a floor.
2
u/tigerhawkvok Sep 06 '26
Writing and maintaining a 2025 system with 2016 inputs from an extension on a 2010 data model with 2019 output contracts compatible with legacy ingestors is..... tricky and inelegant.
2
u/nasbyte Sep 08 '26
The statement could not be more right, especially with AI slops
2
u/Kiana_Harpel Sep 10 '26
I think one thing that makes this worse now is how cheap it is to add more code. It’s easier than ever to “just add one more layer” instead of simplifying what’s already there. The hard part isn’t writing the fix anymore, it’s having the discipline to delete things and keep the system understandable.
3
u/Creativator Sep 05 '26
There used to be an obfuscated code contest where the winner produced the most comically illegible code that still ran.
1
u/ben_sphynx Sep 06 '26
Sometimes things can stop working simply because a data threshold has been passed beyond which the software no longer functions - the breaking change might have been made many years ago, or be a fundamental design issue.
-5
u/shizzy0 Sep 05 '26
Within a fixed amount of memory there is a limit to how many expressions can fit. If we had a means of ascribing “badness”, we could enumerate all the expressions and find the worst. So there is a limit if the code size is limited; however, if you let the code gross in size then yes, it probably can get worse without limit.
0
u/[deleted] Sep 05 '26
[deleted] — view deleted comment
1
u/[deleted] Sep 06 '26
[removed] — view removed comment
-55
u/[deleted] Sep 05 '26 edited Sep 05 '26
[removed] — view removed comment