Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I occasionally worry that when I borrow snippets of code from websites, etc. there's at least the theoretical possibility that this will be copyright infringement. However, small pieces of code to accomplish common tasks may be too unoriginal for copyright and in practice this kind of sharing happens all the time. What are some rules of thumb, ideally supported by legal precedent, as to how substantial and original a piece of code must be to be copyrightable?

P.S. I know there are no hard and fast rules on this and that a definitive answer to a specific case requires a lawyer. However, since I'm only looking for rules of thumb here, answers to this effect will be downvoted.

share|improve this question

marked as duplicate by gnat, Dan Pichelman, MichaelT, Kilian Foth, Doc Brown Nov 19 '14 at 19:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I am not a lawyer and there's no formal training in legal theory behind this, but since you asked for rules of thumb, here's one:

If someone posted some code on a publicly-accessible website, they most likely did it with the intention of sharing something they found useful with other people. If they catch you using it, they're a lot more likely to think, "oh, cool, someone's using my code" then "grr, someone's ripping off my work; I'd better call my lawyer!"

share|improve this answer
Right. I just wish more programmers would understand how Draconian modern copyright law is and therefore make this explicit when it's their intent. For example I wonder if there's any legal basis (not saying it would happen in practice) for suing someone who copies code snippets off Wikipedia into a closed source project, violating Wikipedia's copyleft. – dsimcha Apr 2 '11 at 0:02

Generally, for small pieces of code (as most snippets are) its hard to prove that copying has occured. Very hard (unless something really specific is the case).

As far as practical life goes, it usually boils down to - if you're not making enough money to bother the original author, the original author will not bother you with the lawsuit.

share|improve this answer

The rule of thumb is 5 lines of code.

Another rule of thumb is that if you have some good reason why a piece of code cannot be written any other way due to external limitation, it is not expressive, since there is no room for expression, and therefore not protected by copyright. T

Of course, as you already know, for important stuff, you really should consult a lawyer, but these are the thumb rules.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.