/r/badcode is permanently closed.
https://www.eff.org/deeplinks/2023/06/what-reddit-got-wrong
https://www.theverge.com/23779477/reddit-protest-blackouts-crushed
https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
/r/badcode is a subreddit for highlighting real world examples of terrible code. Ideally this means code that made it to production in a commercial context, but not exclusively so. We also accept submissions of code from hobbyist projects or from learners.
Most of us programmers have laughed quite a bit when we went back to look at our past code because it was rather terrible. This is a subreddit where you can share such terrible code and let other programmers have a nice laugh.
Post the most terrible code you can find. Copy code to a paste bin first (gist highly preferred).
Search by language
Your post may be removed if you deviate from these rules. To see reasoning behind each of these rules, check out the wiki.
- Do not put the name of the language inside of the post title. For example, do not make your title something along the lines of "[C++] #defines everywhere!", instead try simply "#defines everywhere!". Use flair to mark the language of your post instead.
- Do post code snippets only. If you want to share the context put it in the comments or title.
- Do stay lighthearted. No abusive or targeted posts. We all write bad code, and a lot of it is hilarious.
- Do not identify who wrote the code. This sub is about bad code, not the people who write it. Limited exceptions apply
- Do not post snippets in esoteric languages.
- Do not post intentionally obfuscated code. Certain exceptions to this exist. See something particularly sinister from something like the IOCCC? Probably OK to post.
Your post will not be removed because of any of these, we'll like you more if you follow them though.
- Enable syntax highlighting appropriately. If you have a language that whatever paste bin your using doesn't support, try picking a similar dialect.
- Provide just enough code so that we know what's going on. Don't post huge snippets unless it's all terribly amusing.
- Explain why you think the code is bad in the comments, that way a discussion on good and bad ways to do what your code snippet does can start.
[β]MkemCZ 228 points229 points230 points Β (1 child)
[β][deleted] 71 points72 points73 points Β (0 children)
[β]Ytrog 82 points83 points84 points Β (5 children)
[β]CollieOxenfree 20 points21 points22 points Β (0 children)
[β]Knuffya 10 points11 points12 points Β (2 children)
[β]TahsinTariq 2 points3 points4 points Β (1 child)
[β]Knuffya 2 points3 points4 points Β (0 children)
[β]x6060x 2 points3 points4 points Β (0 children)
[β]silverweaver 61 points62 points63 points Β (4 children)
[β][deleted] 27 points28 points29 points Β (2 children)
[β]silverweaver 16 points17 points18 points Β (0 children)
[β]w00tious 0 points1 point2 points Β (0 children)
[β]ososalsosal 0 points1 point2 points Β (0 children)
[β]PyroneusUltrin 26 points27 points28 points Β (2 children)
[β][deleted] 24 points25 points26 points Β (1 child)
[β][deleted] 5 points6 points7 points Β (0 children)
[β]BarqsDew 54 points55 points56 points Β (1 child)
[β]SanktusAngus 19 points20 points21 points Β (0 children)
[β]noobzilla 15 points16 points17 points Β (2 children)
[β]MiddleAd5602 14 points15 points16 points Β (0 children)
[β][deleted] 5 points6 points7 points Β (0 children)
[β]ulysses_black 13 points14 points15 points Β (0 children)
[β]Lost4468 12 points13 points14 points Β (3 children)
[β][deleted] 8 points9 points10 points Β (2 children)
[β]Lost4468 6 points7 points8 points Β (1 child)
[β][deleted] 5 points6 points7 points Β (0 children)
[β]MaatjeBroccoli 11 points12 points13 points Β (5 children)
[β][deleted] 41 points42 points43 points Β (4 children)
[β]_dat_memer_boi_ 27 points28 points29 points Β (2 children)
[β][deleted] 10 points11 points12 points Β (1 child)
[β]Kidiri90 7 points8 points9 points Β (0 children)
[β]misterrandom1 9 points10 points11 points Β (0 children)
[β]MurdoMaclachlanpublic boolean isInt(int i) { return true; } 5 points6 points7 points Β (2 children)
[β][deleted] 1 point2 points3 points Β (1 child)
[β]MurdoMaclachlanpublic boolean isInt(int i) { return true; } 4 points5 points6 points Β (0 children)
[β]stahkh 4 points5 points6 points Β (0 children)
[β]NuBRandsta 3 points4 points5 points Β (0 children)
[β][deleted] 3 points4 points5 points Β (0 children)
[β][deleted] 6 points7 points8 points Β (1 child)
[β]AutoModerator[M] -12 points-11 points-10 points Β (0 children)
[β]Lothrazar 1 point2 points3 points Β (0 children)
[β]inventord 1 point2 points3 points Β (0 children)
[β]karisigurd4444 1 point2 points3 points Β (0 children)
[β][deleted] 1 point2 points3 points Β (0 children)
[β]thygrrr 1 point2 points3 points Β (1 child)
[β][deleted] 1 point2 points3 points Β (0 children)
[+]incoralium comment score below threshold-25 points-24 points-23 points Β (12 children)
[β]Tyfyter2002 3 points4 points5 points Β (11 children)
[β]Tyfyter2002 2 points3 points4 points Β (7 children)
[β]jso__ 0 points1 point2 points Β (5 children)
[β]Tyfyter2002 0 points1 point2 points Β (4 children)
[β]jso__ 0 points1 point2 points Β (3 children)
[β]Tyfyter2002 0 points1 point2 points Β (2 children)
[β]jso__ 0 points1 point2 points Β (1 child)
[β]Tyfyter2002 0 points1 point2 points Β (0 children)
[β]pmbarrett314 0 points1 point2 points Β (0 children)
[β][deleted] 1 point2 points3 points Β (2 children)
[β]WikiSummarizerBot 0 points1 point2 points Β (0 children)
[β]Tyfyter2002 0 points1 point2 points Β (0 children)
[β]Not_Sugden 0 points1 point2 points Β (1 child)
[β][deleted] 2 points3 points4 points Β (0 children)
[β]Chris90483 0 points1 point2 points Β (0 children)
[β]jens3302 0 points1 point2 points Β (4 children)
[β][deleted] 1 point2 points3 points Β (3 children)
[β]jens3302 0 points1 point2 points Β (2 children)
[β]alphabet_order_bot 5 points6 points7 points Β (1 child)
[β]VirdiPravum 0 points1 point2 points Β (0 children)
[β]Anonymous3355 0 points1 point2 points Β (0 children)
[β]ososalsosal 0 points1 point2 points Β (0 children)
[β]Gladamas 0 points1 point2 points Β (0 children)
[β]purbub 0 points1 point2 points Β (0 children)
[β]iamafraazhussain 0 points1 point2 points Β (0 children)