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?

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

  1. studying example code and applying what you learned
  2. violating copyright

For example if I see some code with a license saying it can't be reproduced, and it has a method called is_prime(int x) and has a for 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.

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?


3 Answers 3


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.

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.

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

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.

However, given the limited number of ways to express the prime-detection algorithm means that the expression of that idea has merged 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).


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.

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.

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

The exact 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.


The line is quite simple: Copying is copying, and getting ideas is getting ideas. Copyright is about copying, not about getting ideas. You can get ideas from any source you like and use them freely. As long as you write code yourself, you're fine.

So you said "What if I write my own"? You write your own, it's not a copy. "What if I copy and paste"? You copied it. And Patrick: Having something displayed on one screen and typing it on another is copying. The method doesn't matter. Medieval monks who worked for ages to create new bibles were copying. And your complaint that copying might not be copyright infringement: Where exactly did you see me claiming that? Don't complain about things that I didn't write.

In academia, there is the matter of plagiarism, where it is considered bad to make people think something was your idea when it isn't yours, and the matter of citations, where people want to see your sources. With code, citations are irrelevant since your source code is there to see. But both are completely independent from copyright.

  • I don't think the second paragraph accurately reflects how copyright law works. Copyright grants a monopoly over the exploitation of an expression. The fact that you typed a derivative work instead of copy-pasting and then editing the original to create a derivative work is not material. Likewise, you can copy-paste something without breaching copyright. To the extent that the distinction emphasised in this answer is correct, it is not material to the question. Commented Jun 9, 2016 at 12:19
  • You seem to think that typing something that you see on your screen is "writing" and not "copying".
    – gnasher729
    Commented Jun 9, 2016 at 12:44
  • No, I think that typing something that is derived from something that you see on your screen can constitute a derivative work for copyright law purposes, despite you never at any time copying anything. Commented Jun 9, 2016 at 13:16
  • @PatrickConheady, that is nonsense. Seeing something on a screen and typing it on another computer is copying. What you write there about derivative works is completely irrelevant.
    – gnasher729
    Commented Mar 4, 2023 at 15:12

You must log in to answer this question.

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