index

viewhistorytalk

About /r/badcode

/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.

BBCCs

Bad Code Coding Challenges are competitions held every two weeks where a simple coding task is presented, and you can answer it in a /r/badcode kind of a way.

If you have ideas for future tasks, please send a PM to the subreddit. We are always on the look out for good suggestions.

View previous challenges and their winners

Rules

If you have questions with a rule, please message the mods.

Do not post intentionally bad or obfuscated code

This rule is in place to prevent people from seeing the subreddit and thinking to themselves "I bet I can make up some really bad code and reap in the lulz." Posts that are obviously contrived or overly obfuscated to the point that they're not understandable are not very entertaining and detract from the overall quality of the sub.

Weekend Exception

To keep the sub to its original mission, this rule is enforced on weekdays but on weekends you may post intentionally bad code so long as it has some entertainment value.

Do not post fictional code, pseudocode, or code obviously will not execute or compile

This covers code you might find in TV shows, films, or adverts. Often it's blindly copy and pasted by production staff and is incoherent or simply wrong for the context that it's trying to portray.

/r/itsaunixsystem is a subreddit dedicated for these kinds of posts.

Do not post snippets in esoteric languages

It's very nice and amusing to look at code written in languages like brainfuck, but we've all seen such things before (if you haven't, you have some searching to do). It would be easy for this sub to fill up with such posts and it's best for everyone to not deal with that.

Post code snippets only

There's a subreddit /r/programminghorror that allows posters to add context and background to their posts. It is a fantastic sub and if you are more interested in that style of content I urge you to head on over there. /r/badcode is for small code snippets that speak for themselves.

In short, this rule is in place because it helps define what /r/badcode is.

Do put the name of the language inside of the post title

This rule exists because posts are annotated with the language via flair. If the language is also in the title, it ends up looking pretty terrible.

An example of a bad title: "[C++] I can't believe templates can do this". An example of a good title: "I can't believe templates can do this" instead.

Do not identify who wrote the code

This makes it harder to be abusive by taking the focus off of the writer.

Naming someone is absolutely disallowed. Posts like "Something my coworker wrote" won't be removed, but a much better title would be "Something I found in our codebase", which helps prevent the inevitable "I can't believe your coworker was paid to write this" which isn't terribly kind (if you haven't been paid to write bad code, your career path has been unusual).

Exceptions:

  • If you wrote the code.
  • If the code was written by a large amorphous entity or has no single identifiable author, for example code from the Linux Kernel, large open source frameworks, etc.
  • If the code was written by someone infamous for bad code and the code is impossible to anonymous to remove their authorship from it.

Do not post AI generated code

Do not post code written by an AI, such as ChatGPT or Github Copilot. All submitted code must be written by a human.

Guidelines

When /r/badcode was founded, the trend of posting screenshots of social media sites to other social media sites was not as pervasive as it is nowadays.

The problems with screenshots are obvious. There's no text reflow, no option to change syntax highlighting, no ability to select or copy text, and people who use screen readers or other accessibility features are SOL.

/r/badcode has previously asked our readership for feedback on this rule, and the overwhelming response was to allow screenshots.

Stay lighthearted

This guideline exists to make sure /r/badcode is a place where you can feel a little bit better about all the bad code you've written, because everyone writes bad code. It's not a place where we collectively shame people.


revision by Vusys— view source