2

If I rewrote an algorithm (small one 100-200 lines), written in some programming language and licensed under Apache 2, in another programming language, should the new code be considered as a derivative work or as a separate work?

And should the new code be licensed under Apache 2 or anything else?

Notice that APACHE2 says

For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.

3 Answers 3

4

If you looked at the actual code (as opposed to a description of the algorithm), it is almost certainly the case that your work is a derivative of the original.

As with any other code under the Apache license, you can license your code under any license you wish so long as you comply with the requirements of the Apache license for the code which is derived from the Apache licensed code.

2
  • then how to make such thing comply with APACHE2? and note that APACHE says For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
    – asmmo
    Nov 16, 2021 at 13:23
  • 1
    @asmmo The section you quote means that instructions to link to another piece of code or call another piece of code's API doesn't form a derivative of that other piece of code. The particular section you quote doesn't deal with questions of reimplementing some piece of code, which is what you ask about in this question.
    – apsillers
    Nov 16, 2021 at 19:33
1

A transcription into another language is usually considered a derivative work. So the programme in the new language must choose a license compatible with the original programme, IFF it is a re-implementation where the developers use the existing code as reference.

You may choose any license, if you never looked at the other programme's sources and just re-implement the idea and functionality (a so-called clean room re-implementation).

3
  • it's not a literal translation. I will look at the original algorithm, understand it, then implement it on my own.
    – asmmo
    Nov 16, 2021 at 14:49
  • 1
    Yes, that's what makes it a derivative, the part where you look at the original algorithm. And as you already have, there's hardly any way to avoid your work of the same thing being one... one cannot willfully forget. Nov 16, 2021 at 15:10
  • 2
    @asmmo Ideas and algorithms are not copyrightable, so in the absolute, if you really could break the implementation down to its abstract algorithmic idea, and come away with an understanding fully disassociated from the implementation you saw, then you could indeed write an implementation with only your copyright built solely from that abstract understanding. Proving that you've done so in a court of law is very difficult; this is why reimplantation is usually performed with at least two people, e.g., en.wikipedia.org/wiki/Clean_room_design
    – apsillers
    Nov 16, 2021 at 19:29
0

It is clear when you read the language of the Apache 2 license, especially the definitions of 'Work', 'Derivative Works', and 'Source'.

""Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work". And the definition of 'Source' even includes documentation.

So even if you do an indirect conversion, even if you (or somebody else) looked at the original source of the algorithm, converted the algorithm into a flow chart (or pseudo-code), that would be a Derivative Work because it is documenting the original Work. Therefore any code you create based on such a flow chart would also be considered a Derivative Work.

Philip and planetmaker have very well answered the question w.r.t. the direct conversion from programming language A to B.

2
  • There is well established case law that a clean-room reimplementation of code is not a copyright violation; I don't think it matters that the Apache license may try to extend scope to cover it. Nov 18, 2021 at 9:14
  • @PhilipKendall I sign up to everything you say. In the light of the practical difficulties of a clean-room design I find this way hard to implement. We also have to look at different jurisdictions, in France, for example, OSS license agreements are considered to be contracts, and there the 'extended scope' --as you call it-- might very well apply. Nov 18, 2021 at 12:37

Your Answer

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

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