194

I was recently told by someone that due to the fact that Stack Overflow uses the CC BY-SA 3.0 license any code examples cannot be used in a commercially available closed source application. This individual works for a relatively large international corporation and regularly speaks with lawyers of his company to determine what libraries and sources can be used in their development products.

EDIT DISCLAIMER: This question, the answers and the comment discussions contain a lot of highly speculative opinions and perspectives. We do not currently have any official response from Stack Overflow. However I have contacted their support directly and was told that this question is being looked into. I believe the discussion here is worthwhile but until an official response is made please take anything said here (including my words) with a great amount of skepticism. The point of this question is to clear up confusion not to contribute further confusion.

I read through some of the old Meta posts and I can see how that interpretation could be made. Jeff Atwood's own answer to the question What is up with the source code license on Stack Overflow? states:

The cc-wiki license seems pretty clear to me on this point: free to remix and reuse, as long as you attribute and use a similar license.

Suddenly the interpretation by legal makes sense. If I remix/reuse a piece of code from SO that means I can't use a commercial license on my product.

He goes on to say this:

That said, a snippet of code falls under excerpt category and thus should be free to use under fair use.

However as another user points out in the comments, in the US, the legal doctrine of Fair Use does not apply to embedding excerpts of copyrighted works into source code.

I am an active contributor on SO and hence it concerns me that a legal department would be reluctant to allow their developers to use Stack Overflow as a resource due to these concerns. I have always assumed that the majority of the code I provide in an answer ends up in a commercial closed source product. After reviewing this information I can see why those concerns exist and I believe that warrants some explicit clarification by someone authorized to speak on behalf of Stack Overflow regarding this issue.

EDIT:

My lack of knowledge with regard to legal matters seems to have led to some confusion. I concur with Erik Funkenbusch's comment:

I think what is being asked for here is not for SE to legally interpret the license, but rather for SE to state what their intention was in choosing that license, and to say "Yes, we intend that code from SO Answers cannot be legally used in commercial applications (or applications who's licenses is incompatible with CC-BY-SA)" or "No, we do intend that everyone can use this code for their applications". Now, it can be argued that choosing the license says what they intend, but I think what Spencer wants is verification that what seems like an oversight was actually intentional

Jeff Atwood's follow up statement regarding code snippets seems to imply that the intention of SO is to allow users to copy, paste and tailor code from the site to their needs. At least, that's how I interpreted it when I read his answer. However it is not expressly stated and even if that is the intention it is questionable whether or not that intention is achieved given the current terms of the site.

An explicit clarification of the intention would help developers better understand their obligations when using Stack Overflow as a resource.

EDIT 2:

I wanted to clarify why I believe the intention would be useful. Speculation regarding SO's intended use of source code in answers seems to fall two ways.

One way is how I've described per Atwood's answer to the question I've linked above. Simply put, the interpretation is that Stack Overflow intends that visitors of the site copy, paste and edit source code found in answers per their needs. If that is the intention there is a problem because the current terms of the site do not support that intent.

The second interpretation is that Stack Overflow intends for users to contact the authors to request permission to use their code. However it's questionable whether that intention is being met. Take for example the following answer: How can I get query string values in JavaScript? An example of an answer which contains piece of code that someone may want to copy and paste (and possibly edit) into their project. At the time of this edit the question has 1.3 million views and the answer has been upvoted 3,481 times. Now, it would be naive to think that nobody has copied or pasted this code but there are only two comments regarding the source and absolutely nothing about the license. If the intention of Stack Overflow is that visitors contact authors and request authorization to use this code in a commercial product it is suspect those intentions are being met.

As I see it, both interpretations of Stack Overflow's intentions come with problems that should be addressed. Of course these are just two highly speculative interpretations of an unlimited number of possibilities.

REMEMBER: Again, lots of speculation here. Stack Overflow has been contacted and is looking into it.

47
  • 23
    "However as another user points out in the comments, in the US, the legal doctrine of Fair Use does not apply to embedding excerpts of copyrighted works into source code." - the answer that you've linked to is just the legal opinion of the poster, who is presumably not a lawyer. He commits at least one obvious error of reasoning (claiming that copying code for a commercial application is clearly not fair use because it is not included in a non-exhaustive list of examples of probable fair use Section 107). He provides no evidence of his theory being tested in court. I think it is bullshit.
    – Mark Amery
    Commented Feb 20, 2015 at 22:06
  • 2
    @MarkAmery - Fair enough but clearly there's some confusion surrounding this issue. I believe an explicit response in plain English would clear that up. Commented Feb 20, 2015 at 22:17
  • 5
    "An explicit response in plain English" would be nice, but may also be impossible for Stack Exchange to give honestly. Remember, they don't own the code here, and as you've already pointed out, the license they demand you post contributions under does not cover the use case of copying code into a closed-source application. Whether it is legal (in the US) hinges on whether it is fair use, and Stack Exchange are barely more qualified than you or I to judge that, unless there's some really explicit case law they know about and have never mentioned when this has come up previously.
    – Mark Amery
    Commented Feb 20, 2015 at 22:28
  • 5
    @MarkAmery - If that were the case it still warrants a response from someone who can speak on behalf of Stack Overflow. Even if their response is "We can't say for sure." There's no point in speculating. Commented Feb 20, 2015 at 22:33
  • 3
    If you want a real answer for you, hire a lawyer.
    – crthompson
    Commented Feb 20, 2015 at 23:47
  • 6
    @paqogomez - If you read my question you'd see some lawyers have already been consulted and in their professional opinion SO cannot be used as a resource for commercial products. This is concerning to me and I would like clarification from a representative from Stack Overflow if this is indeed the case. Commented Feb 21, 2015 at 0:00
  • 8
    If your lawyers say that its not defensible, then either get new lawyers or believe them. I cant see how a statement from SE would make any difference. Its those lawyers that are going to have to speak in court.
    – crthompson
    Commented Feb 21, 2015 at 0:04
  • 5
    @SpencerRuport All user content here is licensed under CC-BY-SA 3.0. All users agreed to that. This license makes it pretty clear what you can do with content under that license: If you use it, you have to provide attribution (BY), and offer it under the same or a compatible license (SA = share alike). The SE team cannot redefine this license to mean something more liberal. The legal interpretation you heard (SO code cannot be reasonably used) is correct and generally well-accepted. The Fair Use exception only exists in the US, and is more of a possible legal defense rather than a usage right
    – amon
    Commented Feb 21, 2015 at 0:09
  • 2
    @amon - You could be right. I would just prefer to hear it from SO directly. There has been plenty of speculation and armchair lawyering about this matter. I want to hear from someone who can speak definitively on the matter. Even, as I said earlier, if the answer is "We can't say for sure." Commented Feb 21, 2015 at 0:17
  • 12
    By definition the CC licenses weren't designed for software / source code licensing. Stack Overflow uses the CC-BY-SA because it's intended as documentation resource, not as code repository. So you won't get an official interpretation on that, in particular not in a generalizable form.
    – mario
    Commented Feb 21, 2015 at 0:55
  • 13
    I think what is being asked for here is not for SE to legally interpret the license, but rather for SE to state what their intention was in choosing that license, and to say "Yes, we intend that code from SO Answers cannot be legally used in commercial applications (or applications who's licenses is incompatible with CC-BY-SA)" or "No, we do intend that everyone can use this code for their applications". Now, it can be argued that choosing the license says what they intend, but I think what Spencer wants is verification that what seems like an oversight was actually intentional. Commented Feb 21, 2015 at 1:17
  • 15
    Interpretation of written laws and contracts never means anything in the USA until it is put to the test. In front of a judge and jury, the decision becomes precedent that will be quoted in future cases. Nobody yet has been dumb enough to claim a copyright violation on code he posted on SO and make a case out of it. Nobody will. Commented Feb 21, 2015 at 1:28
  • 4
    @RubberDuck: There's no problem until people start trying to treat tutorials as if they were debugged, fully ready-to-use code. You want copy/paste ready code, ask the contributor to license it under a license meant for code.
    – Ben Voigt
    Commented Feb 21, 2015 at 2:45
  • 3
    @BenVoigt - Have you read the license? It says "remix, transform, and build upon the material". This goes beyond just copy/paste ready code. Copy/paste/edit doesn't release you from the license. Commented Feb 21, 2015 at 3:28
  • 3
    @SpencerRuport What we really need isn't just an authorized statement, because even if Stack Exchange Inc. decides that people should be allowed to reuse code, as people do, it would be illegal for them to encourage that given the existing licensing. They'd need to start dual license the code under a suitable license, and for that you'd need authors to agree - it couldn't be done retroactively. I agree that this is desirable; I just lost all hope years ago. The links provide context for why. Commented Feb 22, 2015 at 18:55

12 Answers 12

8

Thank you Dreaded semicolon for pointing out that the change I mention in my original answer below seemingly never went into effect as shown in A New Code License: The MIT, this time with Attribution Required, which itself is probably the best answer to this question.


https://meta.stackoverflow.com/questions/312598/the-mit-license-clarity-on-using-stack-overflow-code?cb=1

And now everything has changed, well, as far as I understand the licence above still applies to code added before January February March 1st 2016 (that subject to change thing is kicking in already...), but that link says all code after is under the MIT license.

Probably subject to change etc. so just go look for yourself.

4
51

Early on, I decided that posting my answers in a less restrictive fashion was better. Therefore, my profile includes:

All original source snippets I post on Stackoverflow.com, and other sites in the StackExchange network, are dedicated to the public domain. If you do find value in my answers, I would very much appreciate an attribution and acknowledgement where possible.

I understand there are places where the concept of "public domain" doesn't exist, but for the rest of the world, I would like content I offer in the spirit of "hope it helps someone" not to be encumbered by licensing questions.

Update

I found the comments pointing to the shortcomings of trying put things in the Public Domain convincing, and decided to instead dual license my answers under the MIT License.

22
  • 32
    I like this and will implement it in my profile as well. Honestly, this is what I thought StackOverflow was all about when I joined. Particularly in an answer (but even pertaining to questions from the other direction) how do you post code as an answer to someone's problem and expect them to not use it?
    – mbm29414
    Commented Feb 21, 2015 at 14:16
  • @mbm29414: depends what you mean by "use". If I ask a non-programming question on a forum somewhere and want to "use" information from the answer in a commercial work, then I can paraphrase the information I get back in order to avoid copyright concerns (I might consult my lawyer). However, if I copy an answer verbatim then I might well be plagiarising. So, is there something special about code answers that means "use the answer" implies "copying or remixing, for copyright purposes"? If so, then personally I'd worry that I'd asked a "do my homework for me" question. Commented Feb 21, 2015 at 18:03
  • ... that said, I've had a similar dedication in my user info for years. I do agree that if someone wants to copy my SO answer, I don't care to stop them. I just don't think I generally "use" SO answers by copying code from them. Normally for me the license of SO answers that I find helpful, is more or less irrelevant, because (in my opinion) I'm not using them in a way that requires a license anyway. If I was publishing the question and answer on my own site, or copying code answers into my own code, then I might worry. Commented Feb 21, 2015 at 18:06
  • 8
    @SteveJessop Which brings up the question of what it means to "[copy] code answers into my own code". How different does it have to be to not be copying? If I do copy and then tailor it to my needs, when does it "exit" the license?
    – mbm29414
    Commented Feb 21, 2015 at 19:09
  • 2
    I like this approach but I feel like a way to publish the license you select of all your answers should be a feature of the site. This would mean that the license would be in plain view on the answer itself rather than expecting people to go digging in your profile. Something like this: i.imgur.com/8LRGKie.png Commented Feb 21, 2015 at 19:47
  • 1
    Public Domain has its own peculiar set of issues whic sqlite deals with sqlite.org/copyright.html
    – Toby Allen
    Commented Feb 21, 2015 at 20:26
  • 1
    So, Sinan, is it accurate to say that everyone on earth who has used a code snippet of a significant length provided as an answer on SO, can be held legally liable if they used the code in a private license, for-profit application? Unless the owner of the answer has announced something like you did, some user could potentially take legal action against anyone who uses a significant code snippet from one of their answers for profit in a closed source project?
    – user2076675
    Commented Feb 21, 2015 at 23:14
  • 10
    That's a scary prospect considering SO might be the single most powerful programming problem solving tool on Earth. I'm willing to bet more than a few lines of Stack Overflow code are floating around as solutions in profitable applications around the world. We developers are efficient creatures - if the code works, we'll implement it directly into our applications without any modifications other than a few comments. I guess no one would ever be able to prove that a snippet originated from SO but the mere fact that one could be held legally accountable is not cool to say the least.
    – user2076675
    Commented Feb 21, 2015 at 23:21
  • 4
    You should never make code "public domain" if you intend to use it yourself for anything. If it's public domain, it is possible in certain cases for others to claim copyright on it and prevent YOU from using it. See wired.com/2012/01/scotus-re-copyright-decision for an extreme example. It's always best to have at least BSD or MIT style license. Commented Feb 21, 2015 at 23:28
  • 2
    and what stop you from changing this line to "you should never use my code in commercial software" and sue someone in the future? I am not necessarily speaking about you, but mostly what stops any person who writes this to change their statement. Commented Feb 21, 2015 at 23:34
  • 7
    @Erik: Also you have a very weird interpretation of that SCOTUS ruling. It concerns works which were placed in the public domain by law, not by their creators, and when the works were removed from the public domain, the rights went back to the original copyright holders. Saying that somehow allows a third party to claim copyright and prevent the author from using his work is utter nonsense. Only a copyright assignment can have that effect.
    – Ben Voigt
    Commented Feb 22, 2015 at 1:03
  • 1
    @BenVoigt - I said it was an extreme case. The point is that laws are fluid, and SCOTUS has given congress the right to change copyright whenever they want retroactively on the public domain. However, this was just the first thing that came up in a search.. other examples are collections, where you can "copyright" collections of public domain works. Further, even if someone claims copyright on something you put in the public domain, it could be very expensive to litigate otherwise, an explicit license has much more cut and dried terms. Commented Feb 22, 2015 at 2:40
  • 1
    How about unlicense.org
    – Nathan
    Commented Feb 22, 2015 at 18:07
  • 1
    Upvoted. Also including this in my profile. I think this should be more standardized in StackOverflow.
    – aug
    Commented Feb 23, 2015 at 18:31
  • 2
    @Nathan, Unlicense seems to be having some problems: programmers.stackexchange.com/questions/147111/…
    – Pacerier
    Commented Apr 12, 2015 at 12:57
41

IANAL but...

The way I understand the terms of service, Stack Exchange does not claim exclusive ownership of content you submit. They do not require copyright assignment. They do require you to make it available under a CC BY-SA license, which allows them to make it available in turn under that same license.

But there is nothing about the terms of service for contributors, nor the CC BY-SA license itself, that stands in the way of a separate agreement between copyright holder (the content author) and another private entity (such as a development shop) that permits use of that same content (maybe a code snippet) under commercially-friendly terms.

If you want to use content from any Stack Exchange site without releasing your derivative work under CC BY-SA, contact the copyright holder and ask them for permission. Be prepared to pay a fee commensurate with the code's value.

And don't expect Stack Exchange to ever try to force contributors into any license that would conflict with their ability to negotiate commercial licenses on their work, at least not to any greater degree than what CC BY-SA already does (by providing a free license that competes with other possibly paid licenses)

Further observation: The license is what it is, regardless of intent. Stack Exchange cannot change the license terms for content without the permission of the copyright holders. At most they could require a different license for future contributions, but that will never happen either for two reasons:

  1. Having some content under one license and some under another would actually be confusing, unlike the current status quo which is merely perceived as complicated by a few.

  2. Mandating a BSD-style license for contributions would drive experts away in droves. Not just the ones who believe in the principles of copyleft, but also the ones who believe in others' right to copyleft their contributions. At a minimum, experts who feel this way would entirely stop including code in their answers, and answer with text only (assuming that text continued to be CC BY-SA and the new license covered only code).

37
  • 5
    ++ Yes. It's often forgotten that CC-BY-SA doesn't preclude other licenses.
    – RubberDuck
    Commented Feb 21, 2015 at 2:50
  • 3
    I can see the logic in this and it seems reasonable but unfortunately until SO states explicitly that this is their intention this answer is just more speculation. Commented Feb 21, 2015 at 3:38
  • 25
    @SpencerRuport their intentions are irrelevant. The license is what it is, and no statement from SO will make any difference whatsoever. The copyright remains with the original poster, and if they decide to sue you for violating the terms of the license then that is their right. If you're extremely paranoid note that code posted on this site might be in violation of somebody else's copyright, in which case the original poster may not have the legal right to offer the CC-BY-SA in the first place and you're liable to a much greater degree. Commented Feb 21, 2015 at 4:36
  • 9
    You have a good answer but IMVHO this raises the point: you shouldn't have to contact the code author to get permission to use the code in a product (and this has been covered before). By publishing it on SO the intent is for you to use it if it is useful for the stated purpose. cc-by-sa should only apply to republishing the post itself. This sort of uncertainty is why SE need to have an official statement - if you're gonna select and use a license, explain to people exactly what the implications are.
    – slugster
    Commented Feb 21, 2015 at 5:01
  • 13
    @MarkRansom - What is the point of a Q&A site if I can't use an answer without contacting the author and receiving explicit consent to use the code provided? If intentional it seems like a pretty irresponsible decision by SO to not make their users very aware of the huge potential risk they're taking by using SO as a resource. Commented Feb 21, 2015 at 5:11
  • 2
    @SpencerRuport there are plenty of answers that don't include actual code. And even if they do include code, you're not obligated to use it. Commented Feb 21, 2015 at 5:16
  • 6
    @MarkRansom - That's not an answer. This is a programming Q&A site. If people are opening themselves up to legal troubles by using it as such they should be made aware of this fact. Commented Feb 21, 2015 at 5:20
  • 18
    @SpencerRuport: You have a false dichotomy there. It is not either (A) copy/paste from answers or (B) don't use Stack Overflow. There is (C) read and learn from answers and write your own code, which is the intention of the site and the CC BY-SA license works just fine for that purpose.
    – Ben Voigt
    Commented Feb 21, 2015 at 5:56
  • 9
    @SpencerRuport: Also, why should Stack Exchange go to any special lengths to remind users that copy/paste is in violation of copyright unless there is a license that specifically allows it? This is an issue that programmers have to deal with when they find any code on the Internet, or even in printed books. It is not unique to Stack Exchange sites.
    – Ben Voigt
    Commented Feb 21, 2015 at 6:00
  • 2
    @BenVoigt - Responding to both your comments here, if a user comes across an answer to a question they have with 30 lines of code what do you think is going to happen? 1) The user immediately contacts the author of the answer requesting to use said code and waits for a response? 2) The user manually types out their own code which is mostly identical to the answer? 3) The user copies the code, pastes it into their source code and tweaks it for their needs? Commented Feb 21, 2015 at 6:37
  • 7
    @SpencerRuport: 4) The user reads the explanation, realizes that they've used the wrong calculation for one function parameter, checks the 30 lines of code in the question to see how it should have been done, sees that they've completely forgotten to set another property, and fixes their own attempt by changing only two lines
    – Ben Voigt
    Commented Feb 21, 2015 at 6:44
  • 4
    @SpencerRuport: Remember that StackOverflow is not a code hosting service. It is a Q&A site hosting explanations, and the code merely illustrates the explanations.
    – Ben Voigt
    Commented Feb 21, 2015 at 6:49
  • 13
    The claim that just because you don't copy and paste, you're not infringing copyright is as speculative as the claim that code-copying cannot be fair use. The US has the standard of substantial similarity, which states that if a work appropriates another's "the fundamental structure or pattern" it may infringe copyright even if nothing was copied verbatim. Any time you do any substantial task foo aided by a "How do I do foo?" post on Stack Overflow, you are potentially infringing. Fair use may be all that protects you. I dunno; IANAL.
    – Mark Amery
    Commented Feb 21, 2015 at 11:51
  • 4
    @BenVoigt - Your argument has a number of flaws. Your argument "why should Stack Exchange go to any special lengths to remind users that copy/paste is in violation of copyright" flies in the fact that SE goes to great length to prevent other kinds of copyright violation (linking to pirated ebooks or sites that provide them, for instance). They also do not allow questions and answers primarily intended for copyright infringement purposes (hacking, etc..). I would argue that SE has an inherent responsibility to protect users, since it "enables" users to violate copyright without knowledge. Commented Feb 21, 2015 at 23:37
  • 3
    @BenVoigt - especially since it would be extremely easy for SE to provide a disclaimer (and no, hidden in the ToS does not really count, particularly when it flies in the face of the assumed use of the site) on each post (even a link to said disclaimer). Other sites even go so far as to have users select a license they wish to associate with their submissions, and have that license visible on each submission. I'm not suggesting that SE needs to go that far, but it seems clear that the copyright reality is contradictory to the presumed purpose of the site. Commented Feb 21, 2015 at 23:42
22

IANAL but...

Most of the code on SE sites is so limited and resides in such massively independent snippets isolated from their originating problems that they can hardly be considered unique works of their own.

For example, if you asked how to check for some value in a file in PowerShell, take advantage of function pattern matching in Erlang, avoid NULLs in SQL table definitions, implement dispatch functions to create OOP objects in Scheme, take advantage of virtual functions in C++ class definitions, or any of the other bajillion or so basic questions out there you are almost certain to receive an answer that illustrates its point by way of a short one-off example, not a complete program that performs some unique and useful function.

What I am saying is, snippets are both probably not considered "works" and, most importantly, they are not unique at all. The exact same code is almost certainly written and rewritten thousands of times per day, because example answer code is almost always examples of generally accepted idioms.

With this in mind, is it plagiarism to use phrases like "don't get ahead of yourself", or quote a common programming aphorism that has appeared on this site? Of course not, because they are idiomatic expressions of common ideas.

More extensive code, of course, may introduce licensing questions, but most of the code on SO is isolated snippets or one-off examples of idioms. In any case, SO's encouragement of replication of "the relevant bits" of linked information introduces some interesting questions pointed the other direction, especially when code is involved.

7
  • 16
    Does this mean we could prohibit people to post (and answer) long fix-it-for-me code dumps on legal grounds!? That'd be fantastic! ;o)
    – deceze Mod
    Commented Feb 22, 2015 at 11:59
  • 2
    @deceze That would be pretty insane. OTOH most of the DMCA is even worse. I think it comes down to whether anyone would actually try enforcing any of this. An employer may forbid an employee to post any code (or "derivative works") in a question (rendering questions useless), and the stated SO policy seems to actually forbid inclusion of any significant works here in closed-source derivatives (rendering answers unusable). It is amazing how quickly things get stupid once we try to project a sense of individual morality onto a group, even when everyone has the best of intentions.
    – zxq9
    Commented Feb 22, 2015 at 12:49
  • 3
    @zxq9: Please stop pretending the only "use" of an answer is to copy/paste from it.
    – Ben Voigt
    Commented Feb 23, 2015 at 15:49
  • @BenVoigt That was the focus of the question when it was written originally, so that is what I addressed. I don't see how snark adds anything to the discussion.
    – zxq9
    Commented Feb 23, 2015 at 22:30
  • @zxq9: No, I'm serious. Being the topic under discussion, and being the only use are entirely different things. If it is the only use, and we assume that StackOverflow is meant to be useful, then it follows that StackOverflow is meant for copy/paste. But because there are other uses, it's entirely possible for the intention to be "don't use code in your own projects, ever, it is there only as a repeatable demonstration that an answer is correct". Of course, the reality is somewhere in between.
    – Ben Voigt
    Commented Feb 23, 2015 at 23:20
  • Wow... srsly. I never even implied that the only "use of an answer" was to copy/paste it, I simply addressed the question directly. Last time I try answering something on meta; I've got other stuff to do with my time.
    – zxq9
    Commented Feb 23, 2015 at 23:34
  • @zxq9: Sorry, then I guess I don't understand what you meant by "forbid inclusion of any significant works here in closed-source derivatives (rendering answers unusable)" in your comment to deceze.
    – Ben Voigt
    Commented Feb 24, 2015 at 0:09
19

I received a response from Stack Exchange.

Spencer,

Sorry we haven't been able to give you more help. More sorry that I still can't add much helpful info. Giving a response that I know is not solving someone's need is about as unsatisfying as this job gets.

I checked back with the folks who liaise with legal, and confirmed that for the time being, they don't think it's legally fair to our users to try to interpret what we think the license means or what we might intend: the license speaks for itself. More specifically, I'm told folks who deal with legal issues are following up on some of the questions that have been raised in the hopes of being able to be more helpful, but we don't have in house counsel, so it could realistically be a month or two before we can offer up a better answer than that the license should speak for itself. As a non-lawyer, I know it's often not that simple.

In any case, sorry I can't offer more info for now, and thanks for your patience!

The Stack Exchange Team

I have responded with another email.

Well I appreciate the response but the fact is Jeff Atwood has already interpreted what he (and by association Stack Exchange) thinks the license means or what you might intend. Every time this topic comes up people reference his answer.

https://meta.stackexchange.com/a/25957/131570

I agree that what's fair for the users is of high importance. So do the people who are responsible for this kind of thing SE believe that this conflicting information is fair to it's users? Perhaps this answer should be removed?

10
  • The thing that makes this hard to interpret is that that's his personal account. Not an "official company account".
    – Pacerier
    Commented Apr 12, 2015 at 13:05
  • 4
    @Pacerier - In his answer he says "We're not sourceforge, github, or codeplex." He's not speaking from a personal perspective. Commented Apr 13, 2015 at 14:51
  • But it's highly likely to be regarded as a personal comment in courts. At the minimum it'll need to be signed off "The Stack Exchange Team" or equivalent, like what you have in your email.
    – Pacerier
    Commented Apr 14, 2015 at 7:33
  • @Pacerier - I'm not a lawyer so I won't speak to that. I'm saying that's not how it is interpreted by the many SO users who read it. Commented Apr 14, 2015 at 20:34
  • "we don't have in house counsel, so it could realistically be a month or two before we can offer up a better answer than that the license should speak for itself" So, um, anything new from them to report?
    – ruffin
    Commented May 28, 2015 at 17:45
  • @ruffin - Silence. I even sent Joel an email. Commented Jun 1, 2015 at 22:13
  • 2
    @SpencerRuport Hey Spencer I feel for you. I asked a similar question before . I think my "dream solution" would be some kind of email blast to SO users encouraging them to choose a license to mark their code. It'd be listed on their profile, whether they do/don't require attribution, etc. One hairly aspect would be if users willy nilly start changing their licensing. For instance, there would need to be warnings like "code submitted to public domain cannot be revoked" etc. etc.
    – D.Tate
    Commented Jun 5, 2015 at 18:45
  • 3
    @D.Tate - I just think outright refusing to clarify their intents flies directly in the face of "making the internet a better place". I've simply stopped answering questions for this and other reasons. Commented Jun 9, 2015 at 18:43
  • @SpencerRuport Well I commend you for trying anyway. I guess if we really wanted to make our voice heard, nothing is stopping us from making a petition or something. lol. I might be down for that. Otherwise this request may just not really be heard. fwiw, sometimes I ask ppl to use their code, like in this comment . But it is cumbersome and kinda goofy. Best of wishes
    – D.Tate
    Commented Jun 10, 2015 at 0:07
  • 1
    Check this out Spencer! I'm excited about this .. still need to re-read it, but it looks like SO really has been paying attention to this issue! yay
    – D.Tate
    Commented Dec 16, 2015 at 18:27
15

Glad this came back up.

Even the CC says not to use CC for software:

We recommend against using Creative Commons licenses for software. Instead, we strongly encourage you to use one of the very good software licenses which are already available. We recommend considering licenses made available by the Free Software Foundation or listed as “open source” by the Open Source Initiative.

I take this to mean that SO licensing is broken.

In the meanwhile...

Make licensing of your code explicit yourself

One way to "fix" this personally is to dual (or more) license your own code, though it's often hard to do properly, especially when you're building on, say, code from an OP. But for code that's yours, it's very easy to add licenses in addition to the CC license SO demands. Unlicense it (or MIT or whatever you'd like) in addition to CC-ing while SO tries to figure this out.

I'm trying this snippet:

You're also welcome to take any code snippet I've sole-source posted on StackOverflow.com and consider it to be dual-licensed under the Unlicense as written on July 8th, 2014 for you, and as a rights reserved copyrighted source when I use it in other projects.

I've heard some well-meaning comments that I can't dual license my code. Well, of course I can! If it's my own, closed source, nothing's stopping me from posting a snippet of it to SO. Even though that snippet is now CC'd too, nothing's stopping me (IANAL) from continuing to use that snippet in my own, closed source code. It's not exclusively CC licensed; it's also CC licensed.

Same with Unlicensing -- you can still treat this as CC'd, but you're also welcome to take the same code that I concurrently released under the Unlicense as well.

If SO thinks it has a right to un-Unlicense my code posted on SO, I'd like to hear it, though I can't see any reason they'd want to. It might be useful for them to denounce any CC copyright interest they have in source code snippets.

Honestly, though, it's time for SO to rip off the band-aid. I realize old answers would be licensed differently. There's nothing aside from asking active users to re-license sole-sourced or derivative works differently once they log in that you can do about that. But not doing anything for so long just forces us all to apply the ill-suited CC license to more quality (and not so quality) code.

0
9

I agree that it would be really nice for someone retained by Stack Exchange to give us an easily readable break down of the application and ramifications of cc-by-sa.

It's incredibly easy to read, but when you sit and think you very quickly come up with complexities:

  • is the compiled version of some source covered under the remix, transform, or build upon phrase?
  • does compiling some source and then distributing it to others who never see the source meet the definition of a contribution?
  • when I offer some source code on Stack Overflow it is done without expectation of payment or credit, does cc-by-sa trump my intentions?
  • if I use a snippet from Stack Overflow I will include a reference link back to the Stack Overflow post, and all Stack Overflow pages have the cc-by-sa link at the bottom. Is this sufficient attribution?
  • a lot of what is covered on Stack Overflow could be described as knowledge that a competent developer could be reasonably expected to know or arrive at under their own effort (i.e. how to call some API method), is it reasonable to apply any sort of license to this more generic and reproducible knowledge?
  • Jon Skeet, Marc Gravell or Simon André Forsberg publish a specialized class on Stack Overflow - what is the impact of using that class in a closed source commercial application?
  • is cc-by-sa intended to only cover publication of the written word (i.e. web pages or books or public source code repositories)?

That's just scratching the surface. It is unlikely that the answers will have much influence on my modest contributions to the site as they are done without expectation of anything except maybe some magical unicorn points.

Stack Overflow is a great tool for the working professional. But I think the creators of complex and powerful tools have a moral duty to provide some guidance about using it. If I use a shovel I need to know that I can hit an underground cable or pipe if I dig a hole. But if I use a pneumatic drill to do the same job I have a whole different set of considerations, and the manufacturer will provide me with a handbook explaining them.

While some of the information relating to the application of cc-by-sa can be googled, it would be great if that could be aggregated in one spot right here. Members shouldn't have to search for the information, nor should they have to interpret how it applies to their specific type of contribution. If after analysis we find that the license is detrimental to the operation of Stack Overflow (i.e. members do not like it so they stop contributing) then it should be possible to come up with a site specific variation that better suits the SO model.

7
  • 5
    Why mention "Jon Skeet or Marc Gravell" specifically? How would using a class that they wrote be any different from using a class someone else wrote? Commented Feb 20, 2015 at 23:49
  • 5
    That is not an answer, but an unnecessarily long comment. Also, most of your questions can be trivially answered. A compiled representation of a program is still that program – original licenses apply. Whether or not you contribute to the work is irrelevant for CC-BY-SA 3.0. Unless you explicitly offer a more permissive license, CC-BY-SA applies to your contributions – users cannot assume any intentions of yours. Merely attributing a snippet is not sufficient, since SA=“Share Alike” requires derivatives to also use CC-BY-SA or compatible licenses. […]
    – amon
    Commented Feb 21, 2015 at 0:01
  • 3
    […] Knowledge is not copyrightable, but creative works such as non-trivial programs are. Blatantly copying code is a copyright violation, independently arriving at the same solution is not (but it's difficult to prove violations for trivial code). Code published on SO cannot be reasonably used unless it's also available under a more suitable license. CC-BY-SA is intended for any creative work, but is not very suitable for code. In the end, CC-BY-SA isn't meant to be creatively interpreted by potential code copy-pasters or by the SE team. It's meant to be adhered to.
    – amon
    Commented Feb 21, 2015 at 0:02
  • 2
    Welcome to Meta @amon, this certainly is an answer. The point is that Stack Exchange need to publish an official explanation of the licence. Your comments contain good material, but that knowledge needs to be aggregated in easily reachable one spot. This topic has been brought up repeatedly in the past and we still have no conclusion. No developer should have to google this stuff, just like I shouldn't have to google for the handbook for my pneumatic drill.
    – slugster
    Commented Feb 21, 2015 at 0:19
  • 1
    @amon Even if you put your material into an answer, up votes from the community do not represent endorsement from Stack Exchange - hence why an official publication from them is desirable.
    – slugster
    Commented Feb 21, 2015 at 0:20
  • 1
    @SimonAndréForsberg You are right. I simply used them because many members will instantly recognize them due to their many excellent contributions to the site. A new user could be equally capable of writing and publishing specialized Foo class but they wouldn't be as good for the example I was making. But I suspect you knew that. In any case I've included you in the example so that we don't get side tracked over inconsequential details.
    – slugster
    Commented Feb 21, 2015 at 0:28
  • 1
    compilation clearly falls under the "transform" point
    – Ben Voigt
    Commented Feb 21, 2015 at 2:36
8

Pretend that you google for some topic, and find 10 lines of relevant example on some random website, with no particular license. Or, equivalently, no reliable chain of provenance to show that any license was actually applied by the person who owns the copyright, if any. What would you do?

Well, if you are at work, you should do what your particular corporate legal people want you to do. Some would tell you '10 lines is not enough to make a work protected by copyright law.' Some would tell you to get out the long tongs and deposit those ten lines behind radioactive shielding -- to learn from them and then write your own.

If google brought you here, the situation is only slightly different. Yes, there's a license. But there's no guarantee that the person who put the code in the box did, in fact, have the right to publish it there, under CC-xxx or anything else. Your particular legal department may shrug and say, '10 lines isn't enough to have a copyright', or '10 lines isn't enough to worry about.' Or, they could give instructions about long tongs. SE can't change this, unless they want to become (e.g.) the Apache Software Foundation and require that all people that post code sign an agreement promising to only post code that they actually have rights to license. I don't see that happening.

5
  • 13
    It would be naive to think that the majority of people who end up here through a google search are contacting authors asking to use code before copying it into their source. Commented Feb 21, 2015 at 19:22
  • 1
    True, but where does my answer talk about contacting any authors?
    – bmargulies
    Commented Feb 21, 2015 at 19:48
  • 1
    10 lines describing an hitherto unpublished algorithm can make a work be protected by copyright law. But yeah, in general I would not copy but slightly alter the code from SO and actually even not attribute it - that way it will be hard to prove that it was taken from here. May be counteracting the attribution idea though. But better not to take a risk of being accused of stealing. If of course my projects is compatible with CC-BY-SA than I can attribute readily. Or maybe as a compromise I could say that I got inspired by SO and a particular answer (way to give credit without commiting). Commented Feb 22, 2015 at 20:57
  • @Trilarion: If it is a novel and non-obvious method, it might even be patentable (I think the rule still is up to one year after disclosure). But yeah, attribution is where my moral compass is pointing, and if anyone contacts me to ask for permission to use my work posted here, due credit is all I'm likely to ask for.
    – Ben Voigt
    Commented Feb 23, 2015 at 23:28
  • 1
    @bmargulies, "lines" of code? So is a standing { and } considered one line? What about a one statement array declaration split into 50 "lines" for clarity?
    – Pacerier
    Commented Apr 12, 2015 at 13:10
7

Obviously, I'm not a lawyer either. But:

I see StackOverflow as a kind of book. Yes, copying the book verbatim is forbidden, but learning from the book and using what I learned in closed source business applications is the point of me buying and reading the book.

The same goes for SO: apart from homework assignments, I don't think anybody here professionally develops applications that are so simple that a StackOverflow snippet will satisfy the business requirement. So if I have a question and get a good answer, I paste the answer into my MCVE, which is not production quality code anyway. I will then learn how the problem can be solved in this sandbox and only then will I use my newfound knowledge to solve the actual problem.

Does the code look similar? You bet. I mean there is not much creative freedom of expression when signing an XML document in C# for example. If done correct, all codes will look strikingly similar. But that does not mean that one guy posted it on StackOverflow and now people are no longer allowed to sign XML files.

TL;DR

If you copy from SO verbatim, you and your lawyer really deserve each other. Because good developers don't do that anyway. Developing an application is more than just copy&paste. Learning from the examples here and implementing the ideas behind the sample code in your own application is the point of this site.

5
  • 8
    As I pointed out, this question has 1.3 million views: stackoverflow.com/questions/901115/… Do you think the code in the answer has been copied? Commented Feb 23, 2015 at 15:08
  • @SpencerRuport, It had just been ;)
    – Pacerier
    Commented Apr 12, 2015 at 13:12
  • 1
    I fear I fail to see how to practically apply this answer in many cases. Often, questions are not so much about an idea or a method per se, but about what part of a library to invoke and how to format its argument values. In such cases, there is no underlying idea, and any variation possible is merely superficial (e.g. assigning a value to a variable before passing it instead of passing it directly). Either, the code is copied verbatim (possibly with the aforementioned superficial, hence meaningless changes), or it doesn't work. To be explicit here: "I don't think anybody here ... Commented Dec 8, 2015 at 15:32
  • ... professionally develops applications that are so simple that a StackOverflow snippet will satisfy the business requirement" - in the age of reusable components and complex library APIs, yes, solutions to problems are, in many cases, indeed very much "so simple". Commented Dec 8, 2015 at 15:34
  • If it's no about ideas or method, then it's not copyrightable anyway. There is no way I post "int i = 0;" somewhere and somehow nobody else may use it. In Germany that would be called "Schöpfungshöhe", in anglo-saxon countries there may be a different term. Compare it to a book. I own the Petzold, I'm still able to program in Windows, though he probably described every single API.
    – nvoigt
    Commented Dec 8, 2015 at 19:06
3

Obviously, the CC-BY-SA license was chosen to allow re-publishing of questions and answers by others, so long as they credited the original source/authors and did not alter this published license.

But, publishing (as in re-printing, copying the original text verbatim, etc..) is not the same thing as using that code in your application, and I don't think it was the intention for this license to apply to that. I think it was intended that Fair Use would allow the code from answers and questions to be usable in developers code, but this ignores the thorny problem that Fair Use is not a universal concept.

Perhaps SE needs a "source code license" in addition to a "publishing license". However, since i'm not a lawyer, I can't say whether having two licenses, one more permissive for source code.. would provide a loophole for the more restrictive license for re-publishing.

2
  • Code posted to StackOverflow needs a source code license... but that is not for StackExchange, Inc. to dictate. It's up to each contributor to choose a source code license for code in their answers, or keep their rights reserved (except that they have granted a CC BY-SA license, which as you have noted, isn't supportive of use of answers as code, only as documentation)
    – Ben Voigt
    Commented Feb 21, 2015 at 3:35
  • 2
    Argueing about the most probable intention of something is often counterproductive in legal discussions. It's better to only take into account what has been written down and assume the worst case (very limited Fair Use). That way one should always be on the safe side. Commented Feb 22, 2015 at 20:53
2

warning: IANAL

It makes sense to sit down with your legal department and enumerate what the actual ramifications would be of a developer blatantly copying and pasting code from Stack Overflow and placing it into the proprietary code base. At the very least, I would expect the legal department to agree with your observations; the CC-By-SA wants you to redistribute under the same license if you've modified it, and if you're modifying the code to suit your needs, I could see the rub.

The beauty of code, though, is that more than one person has arrived at that solution, and there is more than one approach to take when writing some specific piece of functionality.

My personal concern would be that of the people wholesale copying the code into their project and believing that it'd just work, which is bad for reasons too numerous to enumerate here. From a legal stance, I could see why the legal team of the corporation would be justified in what they're saying. At the very least, it demonstrates that they're conscious of the licensing of various tidbits of code, and that they're trying to do the ethical thing when it comes to using it (or not).

4
  • I cannot understand why this answer was downvoted. IANAL but it seems that strictly speaking the code published on SO cannot be readily used in a commercial project which does not also use CC-BY-SA. You would need at least another license from the author. So one could in principle sue companies using code from SO that do not have gathered the necessary rights to do so. This answer should have more upvotes. Commented Feb 22, 2015 at 20:50
  • I haven't seen IANAL before. Does it mean "I Am Not A Lama"? "I Am Not A Lawyer"? It's the second one, isn't it? Commented Feb 23, 2015 at 22:36
  • "I am not a laywer."
    – Makoto
    Commented Feb 23, 2015 at 22:37
  • 1
    There are plenty of useful non-trivial code snippets in StackOverflow that will compile and run without modification. I think it's OK to put code snippets into proprietary code bases, but I would appreciate a knowledgeable explanation for why it's OK, and how to do it correctly.
    – Ron
    Commented Aug 5, 2015 at 19:26
1

I wish that StackOverflow used a better clearer license for source code contributions, like the MIT license. Or I wish they would give examples of how they believe we can abide by the CC BY-SA license.

Here is my best attempt at how to copy source code from StackOverflow and abide by the license. If anyone (especially a lawyer) sees a problem with how I'm doing this, I'd appreciate hearing from you.

Put a comment like the following above the copied code:

// The class below was written by StackOverflow user John Leidegren and is licensed
//  under CC BY-SA 3.0 ( http://creativecommons.org/licenses/by-sa/3.0/ ).
// http://stackoverflow.com/a/4634505/386091

Here are the key points that I see from the full text of this license:

  • Section 4(a): include the URL to the license.
  • Section 4(c)(i): give credit to the original author, by name or pseudonym.
  • Section 4(c)(iii): give a URL to the SO source code. (If the source code is in an answer, use the 'share' button on the answer to get a perma-link.)
  • Section 3(b): If you make any changes to the source code, add a comment saying "The original code has been modified."
  • Section 4(c)(ii): If the source code came from the question itself, put the title of the SO question in the comment.

I think that's it, as far as what you have to do.

I would argue that the copied source code is being added to a Collection in your software project, from the viewpoint of this license. That means that the copied source code is under the CC BY-SA license, but the rest of your source code is unaffected.

I think that copied source code also becomes an Adaptation when compiled to machine code, because the license says in Section 1(a) that translations from one language to another (e.g., English to French) count as an Adaptation. So, the one little bit of the executable would be covered by this license. Section 4(b) says that you have to link to the license as part of every "performance" (meaning when the copied code executes) but that's just not possible with most bits of code; you can't display a message "the code that is executing right now is covered by CC BY-SA" in the nanoseconds it takes most code snippets to run! I don't think you have to describe the copied code in credits, if your software has a list of credits, unless you do it for all code snippets from SO, because Section 4(c) says that you only have to make a listing in the credits if you list all contributing authors.

2
  • Your argument hinges on the classification of source-code as a Collection (which gets you out of Section 4(b). However it's unclear to me that this license would view source-code as a Collection rather than an Adaptation, based upon the definitions provided. In particular, "derivative works" are classed as Adaptations, the examples provided of Collection 'elements' are all things that are capable of standing on their own (which code snippets don't), and the license points out that combining audio with video creates an Adaptation.
    – aroth
    Commented Dec 18, 2015 at 8:25
  • ...the argument you're making is something that a court would have to weigh in on, but personally I'm very doubtful that they'd agree that source code is a Compilation of snippets, as you suggest. Established legal doctrine would lean much more heavily towards viewing code (and in particular, compiled binaries built from code) as derivative works and therefore as an Adaptation. And to be clear, it's the entire binary that counts as an Adaptation, not just the particular bits of machine code that came from the snippet. And your entire Adaptation can only be distributed under CC-BY-SA.
    – aroth
    Commented Dec 18, 2015 at 8:31

You must log in to answer this question.

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