There's currently not a single obvious way to approach questions and answers that include too much of a user's own code.

We can suggest edits, but only 3 non-moderator users currently have earned the reputation needed to review that queue or to make edits automatically, and the edit history of the post retains all past versions so the code is still easily accessible. Not only that, editing is very subjective; there's no objective measure of where to draw the line between a snippet and too much code, and it can be very hard to identify the proper MCVE for someone else's question.

We can flag or vote to close, but none of the close reasons available are appropriate and the excess code is not removed unless by some additional action.

We can flag for moderator attention, but all of the moderators are staff who undoubtedly have other things to do than police an expanding portfolio of CS50x support sites, and even in this case it's not clear whether there's a middle ground between leaving the excess code in the post's edit history and deleting it entirely.

Some direction from staff would be appreciated. Should we:

  • Continue to suggest edits to these posts to remove offending code?
  • Continue to flag these posts for moderator attention?
  • Expect a custom close-reason to be added that references the Academic Honesty policy (perhaps copied into its own page in the Help Center)?
  • Expect moderation duties to be passed on from staff to elected community moderators, as is traditionally the case on SE network sites?
  • Expect the edit history issue to persist, under the assumption that if someone really wants to copy code, they'll find a way regardless; or expect posts in violation of the policy to be deleted outright so that no edit history is available?
  • Taking into account that sometimes, it's really important to see the code to be able to help!
    – kzidane Mod
    Commented Jul 9, 2014 at 7:59
  • @Kareem Yes, but the policy explicitly identifies many cases where sharing code is not reasonable. Unfortunately SE lacks the private communication features that would allow one-on-one code review; when someone really needs help with all their code, we should be directing them to ask for volunteers on the subreddit or Facebook group. Both myself and CuriousKiwi regularly provide this sort of private guidance on reddit but it's just not possible on this platform.
    – Air
    Commented Jul 9, 2014 at 15:52
  • I see! It's really difficult to deal with. We do the same on the Facebook group too. But as much as it's really a bad thing for the code solutions to be publicly accessible (though most of them have flows and errors), it's sometimes useful for some people to see the code in the questions and the answers whether they already solved and submitted these specific psets or not. Lastly, for someone to cheat, that's really bad for them at the first place. Yes, they won't deserve the grades nor the certificates, but these are meaningless without true knowledge.
    – kzidane Mod
    Commented Jul 9, 2014 at 17:39
  • @Kareem Yes, it's difficult. I think a major goal of the policy is to limit the temptation for students to take the "easy" route of using someone else's code. The more accessible another student's code is, the greater the temptation would be to use that code instead of writing your own. It could also be expressed in terms of cost vs benefit rather than temptation. There is some interesting research related to this but I'll save that conversation for the chat room. :)
    – Air
    Commented Jul 9, 2014 at 18:59

2 Answers 2


Here's what Glenn Holloway (staff) posted over in the subreddit a few months ago, and I use that as my guideline when moderating posts there:

"Please don't post anything publicly that could rob another student of the fun and enlightenment of discovering how to write the solution on her own. You can display pseudocode. You can discuss in the abstract the merits of one implementation choice or another. But for purposes of this forum, a "snippet" is a piece of code that you make up to illustrate an abstract coding question. It's not a chunk of your problem set solution big enough to give away what others are meant to discover for themselves. If you're unable to express yourself under those restrictions, please ask for volunteers to help you privately. This is an amazingly resourceful and helpful community. You wont lack for knowledgeable assistance."

One drawback here on SE is there is no "ask for help privately" as it is stackexchange's ethos that everything is public (hence even the edits are visible to everyone).

I think it would be worthwhile for staff to add some "honor code guidelines" to the Help Center.


edit to test spoilers

This is a spoiler as normal text.

that works okay.

>! this is a spoiler in a code block.

Shame that doesn't work.

This contains inline code: #include <cs50.h>

Works sorta.

#include <cs50.h> int main(void) { int a; // this doesn't really work as it's quite tedious to type.

  • On the subreddit I generally will remove a post and leave a distinguished comment asking the user to fix whatever's wrong by editing it themselves. More often than not it's promptly fixed and I can approve the post. Since none of the bona fide moderators here are active, we lack those tools, and SE's community moderation tools are extremely limited when the active community is so small. The question here is, how do we use the tools available to us on this site, and do we need more of them?
    – Air
    Commented Jul 10, 2014 at 15:18

One problem is that users are not informed or motivated to police themselves, and the anonymous nature of StackExchange (and the internet in general) prevents practical enforcement. On the other hand, it is possible to help users to adhere to the academic honesty code, and not reveal solutions to problems by mistake.

One hypothetical solution might be to hide code by default. This would require an implementation change to the way StackExchange currently works. I'm not proposing actually doing this as it may be impractical, just suggesting it as a starting point to reason about some solutions.

The process might work as follows:

  1. A notice is displayed when creating a post, urging users to demarcate all source code. This can be further assisted by edits, and encouraged with voting and comments.
  2. Demarcated code is initially hidden when posted, be it an answer or a question.
  3. To view the code, users will need to be logged in, and must explicitly click on something to reveal the code.

This is by no means a foolproof mechanism. It is easily bypassed and does not actually prevent someone with ill intent from taking code.

The point is to help prevent uninformed users from accidentally revealing too much information, or from being unintentionally influenced by someone else's answer.

I also suggest that questions and answers which reveal full solutions (erroneous) or not, should be deleted.

  • 1
    I think a spoiler tag policy would be a decent compromise (and spoiler tags are already implemented on some of the network sites) but short of petitioning the SE community managers to appoint pro tem mods (i.e., staging a coup), I don't see any path forward without some level of participation by course staff.
    – Air
    Commented Jul 22, 2014 at 17:40
  • @AirThomas are spoiler tags something that the mods can set up themselves? or does that require stackexchange staff to make changes?
    – curiouskiwi Mod
    Commented Jul 22, 2014 at 23:30
  • @curiouskiwi The first step would normally be a discussion on meta tagged feature-request. From there I'm not sure, but I suspect it's handled by SE staff rather than community moderators. I hadn't made the request because I have no idea if CS50 staff would be comfortable with such a policy.
    – Air
    Commented Jul 22, 2014 at 23:40
  • So, spoiler markup works here, but not for code blocks. I suppose we could use it in some situations. (see my edited answer for example).
    – curiouskiwi Mod
    Commented Jul 24, 2014 at 4:51
  • @curiouskiwi Yeah, that's the problem - anything short enough to be inline would probably meet the definition of a snippet anyway.
    – Air
    Commented Jul 25, 2014 at 18:22
  • so just as a side note here. I wrote an eeeeentry level problem here and curiouskiwi assumed that I am cheating my way through a class (commenting on academic honesty). I have been working through this problem for about 6 hours now and thought hey, ill ask stack overflow. This is a class that can be non-accredited and is how im taking it. Im sure its a "simple" question as far as you fine folks are concerned. Just understand that writing a code that someone else has done and is posted on github in its entirety is NOT going against any academic dishonesty! I was completely forthcoming. Commented Mar 5, 2019 at 2:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .