I understand that code on Stack Overflow is licensed under a CC BY-SA 4.0 license, and that fair use doctrine may not apply to code snippets.
I also recognize that it is ideal to rewrite code posted on Stack Overflow in our own words, both for legal reasons and for the learning experience it presents. However, what about code that would be hard or impossible to rewrite in our own words because there is only one accepted way to write it? Would it possibly be ineligible for copyright?
For instance, let's say that I go to Stack Overflow because a Python math function like math.modf is not working. I then see a Stack Overflow post explaining that to make math functions work, you need to enter this line:
If I copy and paste the
import math code into my own program, then release it under a non-Creative Commons license, does that mean that I am violating copyright? I'm doubtful that this would be the case due to the originality requirement within U.S. copyright law:
The Originality Requirement
Originality is “the bedrock principle of copyright” and “the very premise of copyright law.” Feist Publications, Inc. v. Rural Telephone Service Co., Inc., 499 U.S. 340, 347 (1991) (citation omitted).
“To qualify for copyright protection, a work must be original to the author,” which means that the work must be “independently created by the author” and it must possess “at least some minimal degree of creativity.” Id. at 345 (citations omitted)
The above chapter goes on to say that:
“[T]here is nothing remotely creative” about a work that merely reflects “an age-old practice, firmly rooted in tradition and so commonplace that it has come to be expected as a matter of course.”
A line like
import math does not strike me as very creative; rather, it is simply a required bit of code for getting Python's math library to run within a program. I doubt it would be necessary to rewrite the code as
import math as m when
import math works just fine.
In other words, I am wondering if the originality requirement implies that some code snippets on Stack Overflow may not be original enough to be copyrightable in the U.S. Please let me know your thoughts.
I do not believe that this FAQ post, while informative, addresses this specific question, since that post does not make any reference to the originality requirement for U.S. copyright. The answer to that post states, in part, that "Anything that you post to Stack Overflow will be under the terms of the Creative Commons license." However, I believe there are cases (such as the one in my example above) where a code snippet may not qualify for a Creative Commons copyright because it fails to meet the originality requirement. In fact, such cases may be substantial, especially for beginner-level questions that address general programming conventions.
tpg2114 pointed out in the Meta forum (where this question had originally been posted) that a detailed explanation + import math or similarly non-original code block + detailed explanation as a whole would qualify for a CC license. I think my main concern is about situations where the code provided is the widely accepted best practice for a particular language, rather than someone's original creative work. In other words, if the line of code reflects how thousands of programmers around the world would accomplish a task because it's the best way to do so, I'm just doubtful whether a copyright license would apply.
tpg2114 also helped me realize that a relevant question here is: if something can't be copyrighted, does it qualify for a Creative Commons license? The following quotes from the Creative Commons website indicate that material that can't be copyrighted also can't have a Creative Commons license applied to it:
- "CC licenses do not contractually impose restrictions on uses of a work where there is no underlying copyright."
- "CC licenses are operative only when applied to material in which a copyright exists, and even then only when a particular use would otherwise not be permitted by copyright."
- "You should also not apply Creative Commons licenses to works that are no longer protected by copyright or are otherwise in the public domain."
Source for all 3 quotes
- This raises a new question: even if a post + code snippet as a whole are eligible for Creative Commons (due to the originality expressed in the text, for instance), if the code snippet by itself does not qualify for copyright because it's similar to import math, would I be able to use that without releasing my own program under Creative Commons?
I believe the following quote may help answer this question:
"To constitute an adaptation [which would need to be licensed under CC-BY-SA as well if the source was CC-BY-SA], the resulting work itself must be considered based on or derived from the original. This means that if you use a few lines from a poem to illustrate a poetry technique in an article you’re writing, your article is not an adaptation because your article is not derived from or based on the poem from which you took a few lines." Source
So in other words, if I take an excerpt like import math from a CC-BY-SA post on Stack Overflow and incorporate it into a larger project, my project may not be an adaptation of the Stack Overflow post, and therefore I may not need to release my project under CC-BY-SA as well. I say "may not" because (1) I'm not a lawyer, and (2) the code snippet isn't just an illustration or an example, but rather plays an important role in the functioning of my actual program.
- I also found this helpful article from an attorney that addresses whether simple code snippets can be copyrighted: However, this article states that Stack Overflow posts are covered by CC-BY, when in fact they're covered under CC-BY-SA.