I have some code for an algorithm that is published on Wikipedia.

Can I use that code in a commercial software? Or would this mean that I would introduce a viral license and would have to share my whole code under the Creative Commons Attribution-ShareAlike License?

  • 4
    Is it the code, or the algorithm, that is published on wikipedia? – MadHatter Jul 13 '18 at 8:30
  • 4
    Do you plan to copy the code as is (possibly copying the copyrighted content) or simply use the Wikipedia article as a source of information about the algorithm and reimplement it in your own code base using your own implementation? Algorithms in and of themselves are not generally copyrightable. See Does copyrighted code protect intellectual property rights on novel algorithms it implements? – Brandin Jul 13 '18 at 10:02
  • It's the code, but I ended up reimplementing it again – joz Jul 14 '18 at 10:31
  • 2
    If you copy the code, then you must abide by the license. If you look at the code only to get a description of the algorithm (e.g. how to sort numbers using Quicksort), and then you reimplement that yourself without copying the code, then that is either your own implementation with your own copyright, or it is an implementation devoid of copyright because it contains no copyrightable elements. Some things are not copyrightable because they are statements of fact with no creativity, or because they are only one of very few ways to express some fact. Algorithms often fall into this category. – Brandin Jul 16 '18 at 6:14

As Brandin said: if you copy the code verbatim, or copy and modify it then you have to follow the license. In this case you are advised to check the original sources since they may be licensed differently.

If you use Wikipedia to understand the method, then create your own code based on that knowledge then it is not restricted by the license of Wikipedia.

  • Even if you use the code verbatim in a commercial product, you could most likely still comply with the CC ShareAlike provisions, depending on how you do it. But without more details from the OP it is hard to give specific advice for this. – Brandin Sep 4 '19 at 8:46
  • The general problem I have experienced was that CC and other licenses were not compatible, so it was pretty hard to incorporate foreign license in a differently licensed codebase. Also it may be suboptimal to separately release integral parts of a large product (like you mentioned the QuickSort example). But Wikipedia most often contains the algorithm and not the specific code. – grin Sep 4 '19 at 8:49
  • But after looking at the code, will mine not automatically be similar? – joz Sep 6 '19 at 7:56
  • Similar is not the same. Here around the judge would ask the professionals whether the similarity is due to the way implementation have to be or it doesn't need to be that similar therefore it was a process of copying. Like if you use a different programming language it cannot be copying, and it's really hard to interpret as a "derivative work" if you look only at the code and not the algorithm. – grin Sep 6 '19 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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