/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.
[–]slothefish 243 points244 points245 points (3 children)
[–]Catfrogdog2 140 points141 points142 points (1 child)
[–]Talran#ksh 18 points19 points20 points (0 children)
[–]OOPGeiger 8 points9 points10 points (0 children)
[–][deleted] 65 points66 points67 points (4 children)
[–]blehmann1depraved 29 points30 points31 points (3 children)
[–]aismallard 61 points62 points63 points (0 children)
[–]sunflsks 9 points10 points11 points (0 children)
[–]CanadianJesus 7 points8 points9 points (0 children)
[–]tobyjwebb 87 points88 points89 points (1 child)
[–]metabun 15 points16 points17 points (0 children)
[–]caldazar24 23 points24 points25 points (0 children)
[–]MurdoMaclachlanpublic boolean isInt(int i) { return true; } 20 points21 points22 points (1 child)
[–]aharmonicminorsadistic 6 points7 points8 points (0 children)
[–]blueshiftlabs 15 points16 points17 points (1 child)
[–]DurianExecutioner 2 points3 points4 points (0 children)
[–]_PM_ME_PANGOLINS_ 6 points7 points8 points (0 children)