/r/programminghorror

Photograph via snooOG

Share strange or straight-up awful code.

RULES:

  • All posts MUST show terrible code. There are no exceptions.

  • No Editor Themes - If it's just your editor that looks bad, it doesn't belong here.

  • No Advertisement Code. This is generally written by people in marketing who only know what "code" looks like from other ads. It's not real code, so it doesn't belong.

  • No Student Code. Yes, they're learning, but bad code is part of the process.

  • No Generated Code. If it's minified JS, generated XML, or what have you, we don't want it here. Yes, the YouTube homepage has an extra right-angle bracket. We know.

  • No Asking for Help. Go to r/learnprogramming. What are you doing here?

  • No Spamming/Advertising. We don't care about your shitty Youtube video or new crypto that will "change the world".

  • Be Nice. No hate speech of any kind is allowed, as well as generally being a jerk. Talk about the code, not eachother.

  • No Direct Contact of the Mods. Please use the modmail, we don't want to be contacted directly.

  • Please direct stories without code to /r/talesfromtechsupport, and programming questions to /r/learnprogramming

Programming Horror is where developers come together to revel in the idiocy of our peers.

This subreddit is meant for sharing funny programming related stories and strange or straight-up awful code.


For the sake of not being mauled by rabid lawyer bears, please make sure to anonymize your stories - changing the names of people and companies.

For code examples, indent all your lines with 4 spaces to make it more readable:

foo = 'bar'

Sister subreddits

  • talesfromtechsupport - Not everything that involves a computer is a programming horror story. For IT support related submissions, head on over here.
  • talesfromdesigners - For our more artistically inclined brothers and sisters.
  • badcode - When you don't have a story to go along with the horrible, horrible code.
  • shittyprogramming - ninjas that only write in the <b>BEST</b> code
  • usemysoftware - A subreddit for software developers to come post their software and for users to test it.

/r/programminghorror

361,388 Subscribers

16

Ternary Operator

1 Comment
2025/02/04
10:13 UTC

22

The final evolution of isOdd

8 Comments
2025/02/04
03:31 UTC

462

This is a 2M€/year implementation. Info inside.

Reposting from ProgrammingHumor because I'm an idiot and I didn't know this subreddit existed.

Long story short, Italy has this platform called PiracyShield which takes 2M€/year of taxpayer money to run. Allegedly, it's supposed to collect anonymous reports of piracy streaming, and take down the domains (?) within 30 minutes.

Recently, the code got leaked - there's a GitHub repo that contains the full deployment. This is the function that verifies the reports. I wish this was a joke, it is not.

Allow me three observations before I leave you to enjoy and discuss all the nuances of this absolute abomination.

  1. The braindead logical naming. Since the service is prone to blocking, the negative phrasing check_unwanteds looks for whether the site being reported is legit (and hence the report would generate an unwanted takedown; return true) or it's actually piracy, and hence you don't want it to not be taken down; return false.

  2. Obviously piracy might very well originate from any of those hosting providers, but I guess this was their best shot at verification. Just imagine what the brainstorming phase might have looked like.

  3. When this crap went live for the first time, they erroneously blocked Google Drive for 24 hours in the whole country. It is reasonable to assume that adding the last element of the if statement "or 'google' in result" was the action taken in order to address the bug. You can find articles online.

On the bright side, my imposter's syndrome made a trip into /dev/null.

23 Comments
2025/02/03
23:24 UTC

1

Sounds fun :D

0 Comments
2025/02/03
19:53 UTC

0

Ty

8 Comments
2025/02/03
18:20 UTC

704

Yes this is a real bug in my production code (using a third-party web-based Rich Text Editor)

17 Comments
2025/02/03
10:31 UTC

149

So beautiful...

23 Comments
2025/02/03
08:03 UTC

186

Unity code. This was an answer on a forum.

23 Comments
2025/02/03
03:13 UTC

156

About a year ago, I was offered a full-stack position for a content creator's upcoming Roblox game. I was informed that the previous programmer literally just did not know how to code. I found this old screenshot of one of the horrors presented to me immediately after opening the game in the editor.

8 Comments
2025/02/03
01:51 UTC

2,244

Rate my even or odd code

116 Comments
2025/02/02
22:22 UTC

76

I notice something new every time I look at it

No, nothing outside of this snippet justifies anything wrong you see. Yes, this is production code.

https://preview.redd.it/3lt2z634ojge1.png?width=341&format=png&auto=webp&s=b9560758eb01ba6a8b1d4745d3dcb3a1dbb9f14f

27 Comments
2025/02/01
15:15 UTC

19

I Am the Documentation – A Breaking Bad Parody for Programmers

3 Comments
2025/01/30
21:35 UTC

0

Can you Help me Start in to Code?

Hello, am 27 and wanting to Start Programmin. I think i want to learn Java but i am Not Sure yet how to Start. Do you have any Tipps or reccomendations that could Help? 🥰

11 Comments
2025/01/30
17:35 UTC

2,296

WTF are these table names???

164 Comments
2025/01/30
05:16 UTC

638

No H button for you

So I work with medical records and there is a scanning program we use. And today seemingly out of nowhere, it decided that the "H button" was banned. It wouldn't accept the input. All other buttons worked just fine. There's really only one type field in the entire program and it's to search a pt's name.

At first I thought it was the keyboard itself. So I immediately swapped it out. But nope, still nada. Then I pulled up notepad and "h" came right up no issue. Pulled up another worked just fine again.

I have no idea what the issue is. I've never heard of this before.

I ended up doing ye ol IT answer to everything and restarted the PC. And the issue went away.

But it's driving me nuts as to why it happened. I hope someone here might have an answer.

32 Comments
2025/01/29
21:47 UTC

230

In my cross-platform abstraction layer for a window & its events.

27 Comments
2025/01/29
08:15 UTC

13,123

My roommate spent hours debugging his game today

265 Comments
2025/01/28
02:42 UTC

2,352

How my senior dev expects me to logout 😭

222 Comments
2025/01/27
07:20 UTC

0

DSA Help needed

HELP!!! Was doing a Question on Strings and just couldn't get the logic ,Tried searching for the question on leetcode and GFG but couldn't find it can you guys help me solve it??
https://ng.tinyc.co/t20dsachallenge

4 Comments
2025/01/26
06:59 UTC

66

Nice one Safari

8 Comments
2025/01/25
14:30 UTC

0

Horrific curly braces! or is it terrific?

13 Comments
2025/01/24
08:45 UTC

0

Why is this valid C#?

20 Comments
2025/01/24
05:50 UTC

0

A 2009 Macbook Pro Mid for programming in 2025

Hello, I recently started programming and I'm looking for a notebook to program outside my room and I can't afford a very expensive notebook, I found a MacBook Pro mid 2009 with 8GB of RAM, Intel Core 2 Duo and a 240GB SSD, will it help me learn to program or is it too old to keep up with programming?

7 Comments
2025/01/23
23:06 UTC

6

Tabourier can go fuck himself

https://preview.redd.it/2qnrf6ra6see1.png?width=803&format=png&auto=webp&s=88d57a47b2e3df8d2783cb27f13d4f7d612ff948

Is this even real computer science? it probably is, i recognize the value of making a map of your code through a flow chart, but who the hell designed these? its come to a point where i genuinely dont know if these are fully meant to be read like a toddler is trying to design a map or if i was just taught poorly

from top to bottom, Warnier's, Chapin's. Jackson's. Bertini's Tabourier's and \"Action\" Flowcharts

Hell, i cant even find any accounts for these methods aside from whatever my college is smoking. is this even a real thing or is my professor smoking a fat one and calling it a day? genuine help here on how i could possibly understand these flowcharts, specifically Tabouriers.

5 Comments
2025/01/23
17:50 UTC

Back To Top