Does learning some advanced, non-trivial coding technique from exiting GPL code (or code with viral license in general) turn my own work into a derivative work?

Are there any widely accepted guidelines or criteria to base such a judgment upon?


Sometimes a solution can be derived from first principles. Yet most engineering achievements are based on pre-existing knowledge how to do it. When building upon an example of a non-trivial and non-obvious technique, it is inevitable that the new work will resemble the concrete expression of the source example very closely: it will express similar concepts with the same words and terminology (used in variable and function names) and it will combine the same language constructs in essentially the same way as the original. Because the whole point of building upon existing knowledge is not to reinvent the wheel.

Doesn't this mean that picking up concrete practical knowledge (as opposed to principles and general skills) from viral information inevitably turns my own achievements into derivative works and thus "infects" them?


  • building upon a solution from Stack Overflow (CC-By-SA). If the solution and the problem is substantial, it is inevitable that your code will closely resemble the original expression of the solution. Wouldn't this render a GPL2+ licensed project, which incorporates GPL2 (only) code, as a whole illegal (since CC-By-SA 4.0 is only one-way compatible with GPL3)?
  • from a moral POV, giving credit is prudent -- but doesn't this specific problem here imply that giving credit to the source endangers your own work of being exposed of copyright infringement and breach of license?

Note: I am not interested in the question if viral licenses are good or evil. I am interested in principles, guidelines and criteria how to draw the line of distinction: where does learning end and derivative work start?

  • 3
    what do you mean by infection and viral? that is a very strong word that might be best avoided... FLOSS licenses are not viral and infecting anything. Sep 26, 2017 at 16:50
  • 1
    @PhilippeOmbredanne seems like a bold statement for me. In colloquial and general understanding, "viral" is precisely the essence of some (but not all) FLOSS licences. The GPL is the example for a viral license par excellence. This does not imply that "viral" is good or bad, it just describes the nature of a thing.
    – Ichthyo
    Sep 26, 2017 at 17:02
  • 4
    This is a general issue with copyright law, somewhat similar to musicians who unconsciously imitate earlier songs. The fact that there is a copyleft license involved is something of a red herring. The issue of "Do copyleft obligations apply?" in the space of copyleft projects without any change into the all-rights-reserved space as "Is this copyright infringement?" (Note I'm not saying this is a bad question! Maybe it's a better fit on Law.SE, but I think it's a good enough fit here as well, though the answer you get here may differ slightly from one you'd get on Law.SE.)
    – apsillers
    Sep 26, 2017 at 18:13
  • agreed that the problem is a general one with copyright law -- yet especially with copyleft / "viral" licences and other FLOSS licences there is the twist that such licences can be incompatible to each other, nonwithstanding the fact that in the end they all intend to achieve the same goal
    – Ichthyo
    Sep 27, 2017 at 15:56
  • 2
    Most books for learning programming are implicitly proprietary (no license to copy = proprietary by default). Yet, many programmers learn this way. Colloquially you might even say "I copied Mr. Stroustrup's style" and so on, but your programs are not actually copies or derivatives of his just because you learned from his book or adopted his style/naming conventions.
    – Brandin
    Oct 4, 2017 at 16:30

1 Answer 1


In copyright law, expression is copyrightable, and ideas are not copyrightable. In particular, expression is copyrightable only insofar as that expression is distinct from the idea is expresses. This is closely related to the "merger doctrine," which states that when an idea can only be expressed in a limited number of ways, then expressions of that idea are not copyrightable: that is, the idea and the expression are inextricably "merged" with one another.

If you can prove that the algorithm or system that you have imitated can only be sensibly expressed in ways that are very similar to the work you have imitated (or that your work is only derivative of those pieces of expression that are "merged" with the idea of the system), then you may succeed in proving to a court's satisfaction that your work is not a derivative of the original. You should hire a very good lawyer who is accustomed to making such finely tuned arguments in the domain of copyright law.

See the Abstraction-Filtration-Comparison test for how U.S. courts have judged the similarity of non-literal infringement in software in the past. Note that it is difficult to prove the negative, "There is no other way I could have sensibly implemented this algorithm," but that is exactly what a merger-doctrine defense requires.

  • helpful answer, thanks. Note especially that a Design Pattern by its very definition is the merger of a solution and a specific way of expression. When the topic is rather specific, (e.g. template metaprogramming in C++), it can be hard to decide if something is a generic design pattern...
    – Ichthyo
    Sep 27, 2017 at 16:11
  • Does it mean that, in order to be safe, one's best bet is to never look into any GPL-d code?
    – Pasha
    Sep 27, 2017 at 20:59
  • 2
    @Pasha Of course one's best bet to avoid infringement is to never look at what you might infringe upon (thereby nullifying the "access to the work" factor in determining infringement). The spectrum between the extremes of "never looked at all" and "this is absolutely obvious infringement" is murky and will be defined by case law in your jurisdiction and how good your lawyer is.
    – apsillers
    Sep 27, 2017 at 22:08
  • 3
    @Pasha if you go that way, then you should also never look at proprietary code. Oct 4, 2017 at 9:00
  • @Ichthyo I learned about the Abstraction-Filtration-Comparison test (and edited the end of my answer) which deals exactly with non-literal copying. There's still no hard and fast rules about what is copying or not, but that will show you one process a court can use to aid their subjective decision.
    – apsillers
    Oct 12, 2017 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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