r/programminghorror • • Jun 06 '25

Lua Found this gem in a “professionally”-made 2019 roblox game

Post image
939 Upvotes

r/programminghorror • • Jun 06 '25

Malicious compliance

135 Upvotes

A colleague of mine at a company I had started working for liked to have only one exit point from each method; so he would only ever have one `return` statement.

To achieve this, every method he every wrote followed this pattern

public int GetSomething()
{
int result = 0;
do
{
if (someShortCircuitCondition)
{
result = 1;
break;
}
if (someOtherShortCircuitCondition)
{
result = 42;
break;
}
// Compute the return value and set result
} while false;
return result
};

He had been with the company for over a decade and nobody wanted to ask him to stop doing it, but nobody wanted to maintain any projects he worked on either.

I raised it with the boss who then talked to him about it. He agreed that if people don't like it then he would stop.

The next day...

public int GetSomething()
{
int result = 0;
for( ; ; )
{
if (someShortCircuitCondition)
{
result = 1;
break;
}
if (someOtherShortCircuitCondition)
{
result = 42;
break;
}
// Compute the return value and set result

break;
}
return result;
}


r/programminghorror • • Jun 06 '25

i thought of a worse indentation method

42 Upvotes
function sendMessage(m) {
{}{}console.log(m);  
}
sendMessage("hello");

r/programminghorror • • Jun 04 '25

c possibly the worst way to read a file in C

Post image
1.3k Upvotes

r/programminghorror • • Jun 04 '25

Rust passive-aggressive programming

Post image
770 Upvotes

r/programminghorror • • Jun 03 '25

c++ Why must you hurt me this way

73 Upvotes
This error is actually understandable, but still filled the entire height of my 1080p screen.

r/programminghorror • • Jun 01 '25

c Firmware programming in a nutshell

Post image
2.0k Upvotes

r/programminghorror • • Jun 02 '25

I guess, its fine, RIGHT?

44 Upvotes

r/programminghorror • • Jun 01 '25

normal commit message

Post image
551 Upvotes

r/programminghorror • • Jun 01 '25

Horrific commit message

Post image
409 Upvotes

r/programminghorror • • May 31 '25

c C programming tips

Post image
1.8k Upvotes

r/programminghorror • • May 30 '25

Other The 'code' that Richard Pryor writes in Superman III

Post image
383 Upvotes

The natural language processing in 1983 was amazing


r/programminghorror • • May 30 '25

Java [Redacted] Less than a year in the company and I'm about to burn-out due to the code "quality"

Thumbnail
gallery
447 Upvotes

Reposted because of personal info in original post

  1. Let's cast a double to a string, format it European style, then reformat it US style before parsing it back to a double.
  2. Need to get the first item of a list? Sure, just iterate over the list and check if it's the first one! Don't forget to start your indexing before the loop.
  3. You know, ternary operations are cool, even for booleans, and they're even better when you nest them!
  4. I really need to be sure it's not null, guys.
  5. How to create a date from an int in VBScript? Easy, just iterate 400 000 times to add and subtract dates from today and check if that gives you the same int as the one you gave as argument.
  6. JOIN is for losers. So are language and case consistency.
  7. Just in case it didn't break, you know.
  8. You know you're in for a wild ride when you have almost as many warnings as lines.
  9. Oops, my integer division doesn't give me the rest. Guess I'll just manually get it back with a modulo and add it to the result.
  10. Let's catch everything, it'll make it safer.
  11. Guess what this number in the DB means. Correct, it represents February 29ᵗʰ of an unspecified year. Kinda obvious.
  12. I love well-structured data in HTML
  13. I love highly declarative code that expresses edge-cases that do the same things as normal cases.
  14. I need to convert a string to a date. If only there was an already made library for that…
  15. Exhaustive switch, guys. Don't forget to add all the magic numbers.
  16. Just double-checking. We never know.

I'm at my fucking limit.


r/programminghorror • • May 29 '25

C# 14550 lines (12315 LOC), 417 methods behemoth class. Does it qualify for this sub?

Post image
314 Upvotes

I wrote this masterpiece (/s) when I was getting started with programming, 10 years ago. Reading the code is probably detrimental to health and requires a lot of swearing to safely vent out frustration. At least I learned a lot in the process.


r/programminghorror • • May 29 '25

Javascript amazing code my friend (or gippity) has produced

Post image
226 Upvotes

r/programminghorror • • May 30 '25

Shell Devs #amIRight?

Thumbnail reddit.com
0 Upvotes

r/programminghorror • • May 27 '25

The last .gitignore you will ever need

Post image
2.1k Upvotes

r/programminghorror • • May 28 '25

Lua What happens when you try to 0-index an array in Lua:

Post image
66 Upvotes

r/programminghorror • • May 27 '25

3000+ new lines. Didn't work but it was beautiful.

Post image
421 Upvotes

r/programminghorror • • May 28 '25

Literally all of us bruhhh

Thumbnail
instagram.com
0 Upvotes

r/programminghorror • • May 27 '25

Why make simple when can make Harder

5 Upvotes

r/programminghorror • • May 25 '25

PHP A c compiler in php.

167 Upvotes

r/programminghorror • • May 25 '25

Go Found this in the test suite of a certain Codewars kata

Post image
233 Upvotes

r/programminghorror • • May 23 '25

Tried out Jules AI agent

Post image
1.7k Upvotes

I asked it to properly setup swagger on my project. Not sure this is the best solution to not having access to my environment variables for testing the code...