As I was reading the question about copy-pasting and particularly, answers of Nikita Rybak and Adam Robinson, something clicked and I wondered if the issues of cc-wiki and plagiarism apply to source code also.

After all, protected content is protected content. When "derivative works" based on posts of StackOverflow end up in source code should they appear there with attribution or not?


You are legally obligated to attribute adhering to the full attribution requirements of Stack Exchange under the CC-BY-SA license as it makes no special exception for code.

However, the Stack Exchange community prefers that instead of copying the code into your application, you learn from it and write your own code. If you do so, usually a nice credit is appreciated but not required.

What is the difference between a derivative work and code that you wrote having learned something? If you copy-pasted and changed a few variable names, that's a derivative work. If you looked at the code, understood what steps the person used, and then rewrote in a way that's best for your application, then it's code you learned from.

  • 2
    +1. I would imagine, though, that the vast majority of people who end up getting answers like this end up copying it verbatim. – Adam Robinson Feb 13 '11 at 18:14

Often times my comments on a method will include a link to the answer that gave the solution.

* Transfers a file from the client to the server.  Code general idea was from:
* http://stackoverflow.com/questions/277260/what-is-the-best-way-to-transfer-a-file-using-java/277266#277266
* By Jon Skeet

I'm not sure if you are legally obligated to do this, but I think it's a nice thing to do.

  • Nobody ever complained about getting attribution... (at least not that I know of...) – uɐɯsO uɐɥʇɐN Feb 13 '11 at 20:24
  • @GeorgeEdison: It may be hard to complain if a source is not available public. Which I guess cc-wiki does not require – Tobias Kienzler Apr 8 '11 at 8:07

You must log in to answer this question.