Where is the line between copying code that isn&#39;t yours and getting idea from trivial code?
<p>I have a tendency to overthink things. Even when writing a paper in school I wondered when I needed to add a citation, as technically people are born knowing nothing and must have learned any fact from somewhere. For example should I cite who claimed Obama is the current president of the US? Should I cite where I got the speed of light from?</p>

<p>This over thinking still haunts me when it comes to code without a license (or a restrictive license) found on the internet. Where is the line drawn between </p>

<ol>
<li>studying example code and applying what you learned</li>
<li>violating copyright</li>
</ol>

<p>For example if I see some code with a license saying it can't be reproduced, and it has a method called <code>is_prime(int x)</code> and has a <code>for</code> loop checking odd numbers up with the square root, would I be breaking copyright if I wrote a similar method? What if I copied and pasted? What if I changed the names?  (E.g. maybe is_prime is a better name for the method than check_if_prime.)  The point is some ideas are so simple they can't really be changed, yet still complex you probably won't create it by yourself yet.</p>

<p>If a person is implementing a linked list, they probably have seen example code for it somewhere. Is this not violating copyright as they just aren't looking at the code while they implement their own?</p>

<p>Not having immediate access to the source doesn't preclude a finding of copyright infringement. If you have seen the source material, subconscious infringement can happen.</p>

<p>However, in this example, both the short phrases doctrine and the merger doctrine would likely prevent the is_prime function from having copyright. Words and short phrases are not individually copyrightable, so the name would be free to take.</p>

<p>Regarding the implementing code, if it isn't an <em>exact copy</em> (i.e. copy and paste), courts will apply the abstraction-filtration-comparision test.</p>

<p>They may find that you took the selection and arrangement of instructions from the original source, albiet using different names. That selection and arrangement would probably be considered a substantial similarity and, if not for the merger doctrine, infringement.</p>

<p>However, given the limited number of ways to express the prime-detection algorithm means that the expression of that idea has <em>merged</em> with the idea, and thus is not protected by copyright. (Or in some jurisdictions, merger is a defence to infringement rather than a bar to copyrightability).</p>

<p>Attribution is typically an academic concept, not a legal one. That is, if you fail to attribute then that may be academic misconduct, it is not lawbreaking unless there is a contract that says you must attribute. If a licence requires attribution and you don't then you do not have the protection of the licence but your use may still be legal if it is fair use/dealing.</p>

<p>Algorithms are not protected by IP law. That is a method of, for example, determining if a number is prime (and there are more efficient algorithms but finding prime numbers is one of the hardest things in mathematics or computing), is neither copyright nor patentable.</p>

<p>The name of a procedure or function is also not copyright because it doesn't meet the literary or artistic threshold.</p>

<p>The <em>exact</em> computer code is copyright and translations to other languages or extensions of it are derivative works and need the copyright holders permission. However, there is certainly an argument that a procedure this simple doesn't meet the requisite creative threshold to be copyright and/or is fair use/dealing. </p>

copyright licensing