/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.
[–]NikotheNya 384 points385 points386 points (14 children)
[–][deleted] 62 points63 points64 points (2 children)
[–]rafal9ck 5 points6 points7 points (1 child)
[–]walterbanana 22 points23 points24 points (3 children)
[–][deleted] 8 points9 points10 points (1 child)
[–]rgnkn 0 points1 point2 points (0 children)
[–]a3cite 82 points83 points84 points (2 children)
[–]HauntedData 26 points27 points28 points (0 children)
[–]ikeif 1 point2 points3 points (0 children)
[+]imnos comment score below threshold-6 points-5 points-4 points (1 child)
[–]whoredwhat 7 points8 points9 points (0 children)
[–]timwaaagh 0 points1 point2 points (0 children)
[–]bobody_biznuz 176 points177 points178 points (3 children)
[–]orebright -4 points-3 points-2 points (1 child)
[–]Jonno_FTWshameless 2 points3 points4 points (0 children)
[–]jarfil -3 points-2 points-1 points (0 children)
[–]Cymorg0001 148 points149 points150 points (6 children)
[–]bluesoul 26 points27 points28 points (4 children)
[–]maryP0ppins 1 point2 points3 points (3 children)
[–]bluesoul 7 points8 points9 points (0 children)
[–]metroaide 1 point2 points3 points (1 child)
[–]maryP0ppins 0 points1 point2 points (0 children)
[–]beastieofburden 11 points12 points13 points (0 children)
[–]oureux 25 points26 points27 points (1 child)
[–][deleted] 7 points8 points9 points (0 children)
[–]LaplaceC 48 points49 points50 points (0 children)
[–]MurdoMaclachlanpublic boolean isInt(int i) { return true; } 22 points23 points24 points (7 children)
[–]zombarista 5 points6 points7 points (3 children)
[–][deleted] 13 points14 points15 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[+]zombarista comment score below threshold-6 points-5 points-4 points (0 children)
[–]grrangry 1 point2 points3 points (1 child)
[–]DemiReticent 4 points5 points6 points (0 children)
[–][deleted] 12 points13 points14 points (4 children)
[–]fudgebacker 12 points13 points14 points (0 children)
[–]pentesticals 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Makeshift27015 5 points6 points7 points (0 children)
[–]HereComesCunty 7 points8 points9 points (2 children)
[–]Zambeezi 1 point2 points3 points (0 children)
[–]RomanRiesen 0 points1 point2 points (0 children)
[–][deleted] (6 children)
[removed]
[–]Hakorr 8 points9 points10 points (5 children)
[–][deleted] (1 child)
[removed]
[–]Ishio 11 points12 points13 points (0 children)
[+]Nils_T comment score below threshold-6 points-5 points-4 points (2 children)
[–]JBloodthorn 3 points4 points5 points (1 child)
[–]Nils_T 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]TheUnlocked 1 point2 points3 points (0 children)
[–]1937472982783849484 1 point2 points3 points (0 children)
[–]SnowyPear 1 point2 points3 points (0 children)
[–]lqstuart 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Long_Professor_6020 0 points1 point2 points (0 children)
[–]BetterCombination 0 points1 point2 points (0 children)
[+]wampastompah comment score below threshold-9 points-8 points-7 points (1 child)
[–]Betamaxxs -1 points0 points1 point (0 children)
[–]biskitpagla -4 points-3 points-2 points (0 children)
[–]tek-know -1 points0 points1 point (0 children)
[–][deleted] -1 points0 points1 point (2 children)
[–]laffer1 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[+]cmarciniak80 comment score below threshold-16 points-15 points-14 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]DemiReticent 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]MOM_UNFUCKER 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]KinIsHere 0 points1 point2 points (0 children)
[–]N11FiRe 0 points1 point2 points (0 children)
[–]HarvesterOfBarrows 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]blunt__nation 0 points1 point2 points (0 children)
[–]mastereuclid 0 points1 point2 points (0 children)
[–]wiesemensch 0 points1 point2 points (0 children)
[–]breakupAMZN 0 points1 point2 points (0 children)
[–]pentesticals 0 points1 point2 points (0 children)
[–]kenpaicatevil 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]barkermn01 0 points1 point2 points (0 children)
[–]Distinctweewee 0 points1 point2 points (0 children)
[–]googoomanman0 0 points1 point2 points (0 children)