29

If I post a question to Stack Overflow that contains large snippets (or the entire thing) of my code, that will be assessed by my university, does this count as plagiarism?

Even though I have written the code myself, when the university sends the document through a plagiarism checker, which compares the similarity of the content of my work to that of work found online, it will spot that my code is on a website and flag this as plagiarism.

Obviously I could just change a few words in the code but I don't think that this will be enough.

So I have two questions:

  1. What is the Stack Overflow policy on posting code that will be assessed by a university?

  2. If I post the code, get my answers, and then delete the question will this prevent the plagiarism software from finding my code on the site? (This question sounds very dodgy. I'm not trying to plagiarize without getting caught. The code is my own but the software will not realize that. I also understand that deleting a question goes against the idea of building up a knowledge base of questions and answers, but under these circumstances will it be okay to do so?)

The reason I am asking this is because I have been incredibly stuck on a programming project for a long time, and I could do with posting a large amount of my code to Stack Overflow so I can ask where the problem is coming from. I can't ask a general question without posting my code because I have no idea what the source of the problem is.

  • I don't know if you can delete an answered question.. – Revious Mar 6 '14 at 20:30
  • 19
    My gut reaction is to ask your professor or grader. In any case, make sure that you include any collaboration statements at the top of your code, including disclosing the Stack Overflow question link. However, heck, I'm glad that you're asking this question instead. It's better to ask permission than forgiveness in this case. – Chris Forrence Mar 6 '14 at 20:30
  • 9
    You shouldn't delete your question after you get an answer. (You can't if there are multiple answers, or an answer with an upvote). – Habib Mar 6 '14 at 20:30
  • @Habib: but if someone wants to disassociate a question from him or wants to delete what he wrote? It become "property" of SE and has no right on his writings? – Revious Mar 6 '14 at 20:32
  • 3
    @Revious No. Even if the post is disassociated, SE still doesn't own it. It's still owned by the author. SE simply has certain rights afforded to it, namely the right to publish it, for others to derived works from it, etc. But those rights don't equate with ownership. – Servy Mar 6 '14 at 20:35
  • @Revious, I am not sure about your particular question, but if disassociating from a post is possible, that would not help the OP, Because it would be harder for him/her to explain to the professor that the content on SO is actually his/her work. – Habib Mar 6 '14 at 20:36
  • @Servy: ah, ok.. but in practice you can ask to edit your post, to delete any sensible data reference, to disassociate from your account or all of these thinks are not a right? – Revious Mar 6 '14 at 20:38
  • @Habib: SO hasn't got a politic on how to handle the request for deleting some article or the source code inside them? – Revious Mar 6 '14 at 20:39
  • 4
    @Revious Yes, you can edit your posts, and you can disassociate it from your account. No, you cannot demand that any post of yours be deleted. One of the rights that you give up when posting your content here is the right to revoke the rights that you give. Again, giving up some of those rights to your content is not the same as making SE the owner of the content. You still own the content, you are just giving up certain right. In the same way that if I lease a car to someone they have the right to use it for a period of time, but I still own it. – Servy Mar 6 '14 at 20:40
  • 4
    @Revious If SE does not have the right to provide the content (which would be the case if the person that posted it was not the owner and did not have the right to grant SE the right to post it) then there is a policy for requesting it be removed, namely a DCMA takedown. It's a legal request for a site to remove content that they do not have the legal right to publicize. – Servy Mar 6 '14 at 20:41
  • @Servy: mmm.. it seems a bit as putting a picture / post on Facebook and loosing the right to delete it. Not really intuitive and also a bit scary to me – Revious Mar 6 '14 at 20:45
  • 1
    @Revious That's the way the internet has worked pretty much from the start. Once it gets out there, it's really hard to get it back. Often impossible. – Servy Mar 6 '14 at 20:49
  • @Servy: mmm.. yes, sometimes it's true.. in forum, and also in the cache of some search engine. I don't know.. maybe is only that this websites seems so organized that I didn't expect this choice. – Revious Mar 6 '14 at 20:55
  • I think the up votes here very likely reflect my own sentiment about this question: We are very glad you are asking this in an effort to use this site correctly, coupled with the external factors here. Kudos! – Andrew Barber Mar 7 '14 at 15:20
51

Let me answer your specific question first, because that will render the rest of your question moot:

The reason I am asking this is I have been incredibly stuck on a programming project for a long time, and I could do with posting a large amount of my code to stack overflow so I can ask where the problem is coming from. I cant ask a general question without posting my code because I have no idea what the source of the problem is.

You aren't at the point yet where you can ask us what's going on. If you post that question, it will most certainly be downvoted, and quite likely be closed.

You need to provide us with a Minimal example. If you're having trouble getting to that point, Eric Lippert wrote a blog post on debugging that you should read first.

To your general questions:

What is the stack overflow policy on posting code that will be assessed by a university?

We don't have a policy on this specifically, except to say that you should have the copyright (or be able to assign Stack Overflow a non-exclusive license to use your work) in order to post the code. Since you are posting code you've written, this is a non issue for us.

If I post the code, get my answers, and then delete the question will this prevent the plagiarism software from finding my code on the site?

You're going to make the community very cranky if you do that, not to mention you'll probably make a moderator cranky too. You can't delete a question with upvoted answers, and if you flag your question for deletion with upvoted answers, it will likely be declined. Stack Overflow isn't here to just solve your problem, we're here to use your problem to help other developers solve their problems. When you break this cycle, bad things can happen, so we actively work to make sure that doesn't happen.

If I post a question to Stack Overflow that contains large snippets (or the entire thing) of my code, that will be assessed by my university, does this count as plagiarism?

Absolutely not. I think you may be conflating two things: What the software detects as plagiarism, and what is plagiarism. Whether the software flags it or not, writing something in two places doesn't turn it into plagiarism; you wrote it. So, as long as the University has no rule about soliciting help from others, even if the software flags it, you should be able to show the professor that it's your account and you authored the code posted to the site.

  • 15
    This. Posting a minimal example that replicates the issue and your code for your university assignment will/should be different and independent of each other – Joe Mar 6 '14 at 20:35
  • Could not agree more with the minimal example note. This site is helpful for that as well (and is noted in some of the documentation on Stack Overflow): sscce.org – Travis J Mar 6 '14 at 20:38
  • 1
    Thank you for your answer. I will try and post a minimal example, this should also solve my problem with the plagiarism checking software. I am aware of what my problem is, I just originally wanted to post all of my code so that readers have context, and can point out if the problem actually originates at an early point, and works its way downstream to the point i'm having problems with. After answers from this question though I will instead just post the bit of the code that is having problems, and just try to explain the rest of my code in writing. – Blue7 Mar 6 '14 at 20:54
  • 5
    @Justin I'd take a step back. Read Eric Lippert's post. While reading that post (to get your question set up for Stack Overflow), you'll naturally come to the size of the question you need for Stack Overflow. It's crucial for your own learning and development to spend the time and go through that post step by step instead of shortcutting the learning process and just posting your code to Stack Overflow. – George Stocker Mar 6 '14 at 20:56
  • I have read/skimmed through Eric Lipperts post. The problem is that my code doesn't have any bugs, the output is just inaccurate. This will be better to explain if I give my specific example. I'm programming a neural network that approximates functions, and even though it works, it just isn't a very good neural network. It has relatively large inaccuracy even for very simple functions. So really, my question is all about neural networks and not at all about programming. SO actually has a pretty big community of people who are experts at neural networks, which is why I wanted to ask there. – Blue7 Mar 6 '14 at 21:10
  • 5
    @Justin If your code is giving the output you don't expect, that's a bug. If your question is, "How can I make a better neural network than what I've made?" We need the smallest amount of code that demonstrates the problem you're having, and in what ways you want it improved. In that case, it'd also help to have what resources you've already read through as well as what you've tried to do to improve it. – George Stocker Mar 6 '14 at 21:12
  • @GeorgeStocker, I added one more section. If you don't love it, feel free to roll back. I wanted to respond to that point, but the rest of your answer was so good, I'd rather see it all as one answer if you think it fits with your other points. Again, if not, revert away. – Jaydles Mar 6 '14 at 22:51
  • That's what community wiki was meant for. – BoltClock's a Unicorn Mar 7 '14 at 3:45
  • “be able to assign Stack Overflow a non-exclusive license to use your work” That sounds as if SO had the right to publish the work, but no one else. But that's not how Creative Commons (which is required by SO) works, you have to give that license to everyone. I think that's a significant distinction. – svick Mar 8 '14 at 22:52
  • 1
    @svick, no, it's the opposite. The non-exlcusive part means that it doesn't prevent others from potentially having the right to publish, too. – Jaydles Mar 10 '14 at 20:13
  • @Jaydles I think you're saying "if you publish something on SO, you can also publish it elsewhere, possibly under a different license". That's true, but it's not related to what I meant: "if you publish on SO, anyone has the right to publish your work, under the terms of CC". You don't really assign that non-exclusive license to SO, you assign it to every person in the world. – svick Mar 10 '14 at 20:18
  • @svick, I agree philosophically that that's the net effect, but not legally: When you post under CC-SA, you're granting SE a license where the conditions are that we must do a bunch of things, one of which is allow others to take and re-use it under the same conditions as long as we are publishing it. At which point we are licensing it (non-exclusively) to whomever does so with the same conditions. But,from a legal perspective, it is technically an arrangement ("meeting of the minds") between the poster and us when it's put here. – Jaydles Mar 10 '14 at 20:29
  • @svick That's another part of the CC-license that isn't really in question here. The question here is "If I post it to Stack Overflow, is it plagiarism?" And the answer is: So long as you've either 1) written the code, or 2) are able to assign non-exclusive licenses ('ar e able' means you physically have the power to), then you can post it here. An example would be work I do for my employer. I may or may not be able post internal code to be posted on Stack Overflow, depending on my work arrangement. It's not enough that I've written the code, I must also be legally able to let SO see it. – George Stocker Mar 10 '14 at 20:30
11

If you are the one providing the content to SO then you still own that content. It is yours. Posting it to SO does not change that. You are not giving up ownership. You are giving up certain rights, but not ownership. For example, by posting it here you are giving everyone in the world the right to use whatever you provide, or derive works from it, so long as they attribute it to you.

Because you still own it, you can continue to use it elsewhere. You are not required to cite SO as the source, because it's yours. If some software spits something out claiming that "the work that you claimed to be yours actually came from somewhere else", you can simply say, "that somewhere else that it came from was also from me, so it is not plagiarism."

Again, all of that is for the content that you contribute.


If you weren't the one who contributed the content, i.e. you are using code that someone else provided in an answer:

You need to provide attribution to use that content. That content does not belong to you. If you provide proper attribution, then you are not violating the author's rights.

However, your particular schools policy (or the policy of a particular course/assignment) on using the works of others may well be entirely different from intellectual property rights law. Your school may require that you never use the works of others, may have limitations on the scope of the result that may be dependent on others, or whatever else they want to require. It is up to you, and you alone, to ensure that you do not violate such rules, not SO. If you want to cheat on your homework, there is no site policy that is going to prohibit you from doing so. Some individual users may have a problem with it, but it's not universally prohibited by the site's guidelines.

As for deleting the question after getting an answer, there are mechanisms in place to prevent this. This is abusing the site. Answers here are not here to help just the person to asked the question, they're here to be a repository of knowledge for the world at large. As such, any question with useful answers cannot be deleted by its owner, and requesting that a mod delete it is unlikely to result in the contents deletion. On top of that, you really can't get anything off the internet entirely, once it's up. It's entirely possible for records of its existence to still be accessible through some form of searching.

6
  1. It's not a question of Stack Overflow's policy. It's a question of the university. It's not plagiarism if you wrote the code, but their software doesn't know that. You could ask them about it?
  2. Pasting a large block of code with a "where's the problem" question isn't very on-topic for SO. You should try and boil the code down to be as Minimal, Complete, Tested and Readable as possible. Work backward from the error message you receive, removing all the code that doesn't affect that output. It's possible that exercise can even help you find the answer on your own.
  3. Deleting your question after receiving answers, is as you mentioned very bad. Stack Overflow is a resource not just for those asking, but also for future visitors to stumble upon answers without having to ask. Deleting your question robs them of that, and as such is hard and in many cases impossible to do.
4

What is the stack overflow policy on posting code that will be assessed by a university?

It isn't Stack Overflow's problem. If you are posting your own code online, that is your decision. By posting it on SO, you do however perpetually and irrevocably license it to the site. If you don't have the permission to do so, don't do it. But that is up to you.

If I post the code, get my answers, and then delete the question will this prevent the plagiarism software from finding my code on the site?

I don't know, and again it doesn't matter. Just don't do this. The licensing I told you about before still holds. And if you get an answer, and if it has upvotes, you simply can't delete your question any more. Even if you could, deleting would be a bad thing to do, and won't result in a lot of positive attention. Destroying content is also a no go.

In summary, only post stuff online, if you don't mind it staying online. If you have any doubts about this, don't post at all.

3

does this count as plagiarism?

No, you wrote it. If you copied someone else's code then that is plagiarism.

What is the stack overflow policy on posting code that will be assessed by a university?

Stack Overflow doesn't have a policy on that. Whatever you post is visible to everyone, including the University, the President, and Santa Claus.

If I post the code, get my answers, and then delete the question

This is definitely frowned upon. Don't do it.

will this prevent the plagiarism software from finding my code on the site

Probably not, but who knows for sure? Your deleted question is still there and visible to anyone with 10K+ reputation (and moderators). It's not easily searchable, but any links to it will still be live.

Your best bet is to make sure your name is included in the online code. Make it obvious that you are the owner of it. If a plagiarism tool has a hit then a human should investigate it before it gets actioned. In this day and age it is common for people to have blogs etc. on which they have published code. Some code is also pretty generic - there are only so many ways that you can reasonably skin a cat, so the chances that at least some snippets of your code has been published in the past by someone else is pretty high.

You must log in to answer this question.

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