war crimes in programming - A thread to discuss and share horrifying programming ideas/code

  • 🐕 I am attempting to get the site runnning as fast as possible. If you are experiencing slow page load times, please report it.
Just a reminder, if you think those case statements as the beginning of video 2 are bad. I'll remind people that the entirety of Undertale's dialogue is written in a single case statement that goes for 3,000 lines.
Terraria 1.0 had zero concept of prototypes and implemented all of its items via two massive functions, one to create the item (including setting all of its properties piecewise) and another to implement the action performed when the item was used. These were both absolutely gigantic switch statements, IIRC 1800+ lines each, and each switch was on a numeric ID.

As someone who knows very little about modern programming, what issues does this cause?
Very little in regards to functionality, extreme problems in regards to maintainability. There are lots of code generators that'll generate huge switches and such like that at compile time and they're not considered 'bad' because you never actually edit the code they emit, you just regenerate it from your source files which are completely authoritative. In Undertale's case changing an NPC or any given message would mean updating the function in every single locale (since there's gotta be a copy of it for each language).

For comparison's sake, a game I worked on handled this by having unique entity names and localization files per scene, so interactions would just pull the conversation from the current locale dictionary by the entity's name. The locale files were each baked from a spreadsheet with a column for each language and the importer script that read the spreadsheet and emitted locale dictionaries would complain if it found lines that weren't tied to an entity in that scene or vice versa. Made the whole thing very easy to maintain and validate and since all the localization was handled per-scene entity names could be very descriptive (eg 'left_exit_sign') since they only applied to that scene instead of the entire game.
 
For comparison's sake, a game I worked on handled this by having unique entity names and localization files per scene, so interactions would just pull the conversation from the current locale dictionary by the entity's name. The locale files were each baked from a spreadsheet with a column for each language and the importer script that read the spreadsheet and emitted locale dictionaries would complain if it found lines that weren't tied to an entity in that scene or vice versa. Made the whole thing very easy to maintain and validate and since all the localization was handled per-scene entity names could be very descriptive (eg 'left_exit_sign') since they only applied to that scene instead of the entire game.
Ah I see what you're saying, it's primarily a formatting issue rather than something likely to cause bugs?

In the case of the spreadsheet method, would a separate file contain instructions on how to handle text length or would that be within the spreadsheet? For instance if the German version of a line was longer than the English one, would you need to adjust something so it would display the appropriate number of text box transitions?
 
  • Like
Reactions: Email
In the case of the spreadsheet method, would a separate file contain instructions on how to handle text length or would that be within the spreadsheet? For instance if the German version of a line was longer than the English one, would you need to adjust something so it would display the appropriate number of text box transitions?
It was mostly automated but you could fine-grain control it by throwing little control tokens into the dialogs. Left to its own devices it'd just go sentence by sentence formatting text for a box until it wound up over three lines, and then it'd step back to the end of the last sentence and start on the next dialog. With tokens you could have it move to the next dialog early, change text speed/size, etc. It worked pretty well but got a bit hacky at some points, mostly involving situations where something non-text needed to happen inline with the text display. It was nowhere near as bad as the absolute mess of a script language that Earthbound used though.
 
It was mostly automated but you could fine-grain control it by throwing little control tokens into the dialogs. Left to its own devices it'd just go sentence by sentence formatting text for a box until it wound up over three lines, and then it'd step back to the end of the last sentence and start on the next dialog. With tokens you could have it move to the next dialog early, change text speed/size, etc. It worked pretty well but got a bit hacky at some points, mostly involving situations where something non-text needed to happen inline with the text display. It was nowhere near as bad as the absolute mess of a script language that Earthbound used though.
I remember modding the ROM back when I was a teen (because I wanted to fast track some of the grinding and call my friend a nigger if they got far enough) and I vaguely remember running into that scripting language, I thought it was cool and novel for the time.

Now I’m older, and I maintain a legacy VB application with over 300k lines in production since the 90s.
Their scripting language looks cozy and I like it, though I realize this is what desensitization looks like. I have seen things.

My favorite thing about our code base is that you will randomly have massive strings that store values, not by delimiter but by index, created by obtuse “string constructors” from global objects only to finally be stored in a file in a sub directory to be loaded if they exist and if the file name matches the same naming conventions, most symbols in the convention are undocumented and serve some special purpose and sometimes the file has its name changed to switch it to “something else” temporarily to be called by another function, only to be renamed again… back to its original name.
Mind you that the object types are only typically used to create the strings.

Note we have a database that just isn’t used for some things and I have no real reason why it is the way it is.
 
My favorite thing about our code base is that you will randomly have massive strings that store values, not by delimiter but by index, created by obtuse “string constructors” from global objects only to finally be stored in a file in a sub directory to be loaded if they exist and if the file name matches the same naming conventions, most symbols in the convention are undocumented and serve some special purpose and sometimes the file has its name changed to switch it to “something else” temporarily to be called by another function, only to be renamed again… back to its original name.
If you've never encountered Redis take a look at its documentation at some point for a laugh. It's an object server entirely designed around that sort of string conversion/renaming/index-by-ID nonsense. It works and it's good at what it does but working with it always feels like messing with some hacky MUD codebase from the 90s.
 
If you've never encountered Redis take a look at its documentation at some point for a laugh. It's an object server entirely designed around that sort of string conversion/renaming/index-by-ID nonsense. It works and it's good at what it does but working with it always feels like messing with some hacky MUD codebase from the 90s.
I’ve only touched Redis a few times in my life but I’ve never read the src, all I know about it is it’s fast so what you describe doesn’t come as too much of a shock.
I’ll put it on my wheel of catharsis (sometimes I like picking random codebases to grep thru to make myself feel something).
 
Now I’m older, and I maintain a legacy VB application with over 300k lines in production since the 90s.
My favorite thing about our code base is that you will randomly have massive strings that store values, not by delimiter but by index, created by obtuse “string constructors” from global objects only to finally be stored in a file in a sub directory to be loaded if they exist and if the file name matches the same naming conventions, most symbols in the convention are undocumented and serve some special purpose and sometimes the file has its name changed to switch it to “something else” temporarily to be called by another function, only to be renamed again… back to its original name.
Mind you that the object types are only typically used to create the strings.
Note we have a database that just isn’t used for some things and I have no real reason why it is the way it is.

Your job sounds horrific. Isn't old VB single threaded?
 
I can't even work out what he's doing. It's a js file, with a bunch of <div>s in it, so I assume it's meant to be react or some other ui framework of that nature, but he's writing his js inside the html, so it shouldn't even function. Unless... oh. Oh no. OH NO. He's overloaded the prototype to use literal html as a method name? WHY? Why in the fuck would anyone do this? How would anyone do this? I'm going to go and find some whisky because I need to erase this from my brain immediately.
 
  • Agree
Reactions: Evil Whitey
WHY? Why in the fuck would anyone do this?
(Archive)
Iballdesigningdeveloper. CodeWithPK.
Within is a coding fever dream of gibberish spanning years and a handled duo of kids nicely collated by this curious Reddit OP (Archive) if you wanna gawk at this coding content farm further. I'm too revolted to look for funny snippets of nonsense within their backlog of content.
 
We've done coding war crimes, but how about expanding our e-Nuremberg to crimes of talking about code?

Using any of the following words indicate an opinion that should be discarded:

Performant
Footgun
Bikeshedding
_____'s Law

What else?

(I'm leaving out "CoC language" like "be kind" or we'll be here all day)
 
We've done coding war crimes, but how about expanding our e-Nuremberg to crimes of talking about code?

Using any of the following words indicate an opinion that should be discarded:

Performant
Footgun
Bikeshedding
_____'s Law

What else?

(I'm leaving out "CoC language" like "be kind" or we'll be here all day)
"sane"
this term is usually used by people who are clinically insane
 
  • Feels
Reactions: Belisarius Cawl
We've done coding war crimes, but how about expanding our e-Nuremberg to crimes of talking about code?

Using any of the following words indicate an opinion that should be discarded:

Performant
Footgun
Bikeshedding
_____'s Law

What else?

(I'm leaving out "CoC language" like "be kind" or we'll be here all day)

"Clean"
Agile

These two are almost always used by retards who have no idea what they're doing, but they're "following convention".
It inevitably ends up as the most inflexible piece of shit code split across 50 million files, and is completely unmaintainable, but, since they believe in the holy word of Saint Robert of the Martin, they delude themselves into thinking it is.

Reusable
Modular
Microservices

Almost all the time, when people use these terms, they're mediocre programmers with zero understanding of scaling, who have an oversized ego, and want to be able to proudly say "I SOLVE BIG BIG PROBLEM! I USE MICROSERVICE TO SOLVE PROBLEM! I AM SMARTER PROGRAMMER!", only to request 128 cores and 512GB of ram to run their code which handles maybe 1000 users an hour at best, and completely dies when any of their "microservices" crash.

There's no shame in writing a single binary service that does what it has to quickly, efficiently, and can be thrown away easily if you actually need to scale up.
There is shame in being a retard who thinks they need a supercomputer to serve a fucking form on a website, though.
 
"Headless".

You will be solving the same problem N times as it is represented over N systems in N ways. All of these systems will be intimately coupled together defeating the purpose.
 
  • Like
Reactions: botrix_fan
Back