There is some code which is GPL or LGPL that I am considering using for an iPhone project.

If I took that code (JavaScript) and rewrote it in a different language for use on the iPhone would that be a legal issue?

In theory the process that has happened is that I have gone through each line of the project, learnt what it is doing, and then reimplemented the ideas in a new language.

To me it seems this is like learning how to implement something, but then reimplementing it separately from the original licence. Therefore you have only copied the algorithm, which arguably you could have learnt from somewhere else other than the original project.

Does the licence cover the specific implementation or the algorithm as well?

EDIT------

Really glad to see this topic create a good conversation. To give a bit more backing to the project, the code involved does some kind of audio analysis. I believe it is non-trivial to learn or implement, although I was prepared to embark on this task (I'm at the level where I can implement an FFT algorithm, and this was going to go beyond that.) It is a fairly low LOC script, so I didn't think it would be too hard to do a straight port.

I really like the idea of rereleasing my port as well as using it in the application. I don't see any problem with that, and it would be a great way to give something back to the community.

I was going to add a line about not wanting to discuss the moral issues, but I'm quite glad I didn't as it seems to have fired the debate a bit.

I still feel a bit odd about using open source code to learn from. Does this mean that anything one learns from an open source project is not allowed to be used in a closed source project? And how long after or different does an implementation have to be to not be considered violation of the licence? Murky!

This question came from our site for professional and enthusiast programmers.

20

I'd really like to get to the bottom of another question, "If you learn an algorithm from an open source program and re implement the algorithm, have you violated the licence?" I'm asking this from a legal point of view, not a moral one. But even from the moral point of view, is that not a legitimate form of learning? Are we not allowed to use any learning gathered from open source projects? This seems to go against the point of the GPL itself?
–
Chris BarryJun 24 '11 at 19:46

7

@optician The problem is that you want to translate it line by line, which clearly makes it a derived work, like a translation between human languages. The idea itself is not protected by copyright, instead it might be covered by a patent. But beware, IANAL.
–
starblueJun 24 '11 at 19:57

1

@caleb Several german politicians are just now learning that plagiarizing in their Phd theses was not such a good idea.
–
starblueJun 24 '11 at 20:02

3

Commenters: comments are meant for seeking clarification, not for extended discussion. If you have a solution, leave an answer. If your solution is already posted, please upvote it. If you'd like to discuss this question with others, please use chat. See the FAQ for more information.
–
user8Jun 24 '11 at 20:16

1

@optician The Stack Exchange system is not a discussion board, where each post is a topic that can change direction over time: if you have another question you'd like to get help with, ask another question. Otherwise, feel free to edit your question to clarify if the answers you received don't fully address your original problem.
–
user8Jun 24 '11 at 20:18

14 Answers
14

That said, taking every line of an application and changing it slightly for the sole purpose of circumventing copyright law is blatantly, obviously, creating a derived work with no plausible defense whatsoever. Even the boughtest judge and jury will definitely find against you if you ever get dragged into court.

Just as a comparison: companies who do need to rewrite something for interoperability usually hire different sets of people to understand the source, and to create the port ("clean-room implementation"), so that no one can accuse them of creating a derived work. What you propose is the exact opposite.

If the software is successful at all, it would most likely end up in court at some point.
–
Justin CJun 24 '11 at 17:54

3

@optician: Depends on how close you get to re-creating the original, actually, and that's the sort of question you do need a lawyer to answer.
–
David ThornleyJun 24 '11 at 21:22

3

@DavidStone You have it backwards. You must understand that a logical algorithm and a particular expression of an algorithm in code are legally separate; only the expression is copyrightable. The group doing the re-implementation has no contact with the original expression of the algorithm (they only see in-house documentation about the logical algorithm) and their written expression will likely be different from the original expression, so it is quite unlikely they could violate copyright. However, they can violate a patent easily, since their logical algorithm is identical to the original.
–
apsillersJan 4 '13 at 16:37

Subject to certain defenses, it is copyright infringement for someone other than the author to do the following without the author's permission:

copy or reproduce the work

create a new work derived from the original work (for example, by translating the work into a new language, by copying and distorting the image, or by transferring the work into a new medium of expression)

sell or give away the work, or a copy of the work, for the first time (but once the author has done so, the right to sell or give away the item is transferred to the new owner. This is known as the "first sale" doctrine: once a copyright owner has sold or given away the work or a copy of it, the recipient or purchaser may do as she pleases with what she posesses.) 17 U.S.C. §109(a).

perform or display the work in public (this right does not apply to visual art) without permission from the copyright owner. 17 U.S.C. §106. It is also copyright infringement to violate the "moral rights" of an author as defined by 17 U.S.C. 106A. Moral rights are discussed at this location.

It looks to me like you'd be violating item #2 above.

However, I think terminology is a big deal here. You said, "If I took that code (javascript) and rewrote it in a different language for use on the iPhone would that be a legal issue?" (emphasis mine). Rewriting something may or may not be different than copying. For instance, if you looked at the Mona Lisa, then went into your own studio, and painted what you remember of it, then it seems to me you're creating an original work that is your expression of how you perceived the original. If, however, you had a copy of the Mona Lisa in your studio, and you painted a copy of it, rather than what you remember, then I think you're definitely copying.

In the same way, if you use MS Word, and maybe even if you look at some of the code, and then you go and write your own word processor that has functional similarities, I believe there are cases where it was decided that "look & feel" is not copyright-able. (This says nothing of patents, of course.)

You should probably ask a lawyer (as I am not one).

My personal opinion is that a "port" is a derived work and so you have to release the ported code in the same license.

there's also the matter of proving it. If you looked at Word's source code, then wrote your own word processor... you're going to have a hard time proving you didn't copy anything.
–
gbjbaanbJun 24 '11 at 14:58

5

@gbjbaanb: It's up to Microsoft to prove you did, not the other way around, in most countries. Not that it matters, because if Microsoft sues you, you're screwed unless you can get a big firm to take you on pro bono. :-) And if you had access to the Word source code, odds are pretty good you already signed something saying you wouldn't write anything to compete with it anyway...
–
T.J. CrowderJun 24 '11 at 15:22

I'm not a lawyer, this is not legal advice, and if you rely on what I say in any sort of dubious undertaking (1) you're an idiot, and (2) I disclaim all responsibility. This is what I've heard and read over the years from people who seem to know.

Judges don't play "in theory" games. They don't like people who make up ways to twist the law that are perhaps acceptable in terms of logical analysis but which are contrary to the obvious intent and how judges have ruled in the past. Never try to be too clever about the law if there's any chance you'll wind up in a courtroom defending your interpretation.

It is generally accepted that taking a novel and making a movie from it or translating it into another language are creating derivative works, and those are much greater transformations than you're talking about, and require much greater creativity. Look at those as examples; a judge certainly will.

In the US, there have been cases where copying a program more loosely than you're talking about has been ruled infringement. In the US, expect those to be used as precedent.

In other words, you'll be starting a commercial enterprise on a basis that will be found illegal if anybody bothers to look. Not a good idea.

Moreover, if you have any respect for the idea of copyright, or any control an author may have over what he or she publishes, you're being hypocritical. The source code was made available for your use under certain conditions. You're violating the law and the express intent of the author.

Now, algorithms cannot be copyrighted. In the US, courts have ruled that it is impossible to copyright an idea, and anything normally copyrightable that is the only way to express something isn't copyrightable. Therefore, you can certainly use the algorithm.

There is a way to copy an algorithm that's copyright-proof: the "clean room" approach, where one person or group studies the source code and creates a description of the algorithm (with as few implementation details as possible), and another person or group writes new code without any reference to the original source. The closer you can get to that, the safer you'll be.

You also might want to consider that, by posting the question here, you've published a possible intent of violating copyright, in a form that can likely be traced back to you if anybody has a legal right to do so (such as discovery in a civil case, or plain police investigation if this turns out to be a criminal case).

Open source works, because it is a
community. Because it is mutual. You
do not get money by writing open
source code. You get money by
consuming open source code. So why do
you write open source code? To give
something back.

But from a more pragmatic point of view:
If the code you ported is really so useful that you think you should protect it to maintain an advantage (which you don't have, because people using Appcelerator can use it right away), there will be an open source port sooner or later. It will be maintained by a number of people, it will be used and thereby tested by even more people and it will be refined further to incorporate the principles promoted by the target language and to better interface with the prevalent frameworks on your platform. Sooner or later your code will look like a piece of crap compared to it.
Open sourcing is in fact your chance to stay on top of the wake. It's win-win. If you're lucky, you'll even get maintainers for that code and can focus on you application logic, which is what actually makes your product unique.

+1 Some of the best code out there is Open Source. But I can see how adding GPL code to a commercial project can be more of an hurdle when that means open sourcing the whole product.
–
Alexandre JasminJun 24 '11 at 23:28

2

GPL code is prohibited in iOS apps by Apple's licensing terms, as far as I understand.
–
Andrey TarantsovJun 26 '11 at 4:43

2

Well, it seems that one clause in the Apple ToS contradicts one clause in GPL, so while not forbidden, they seem to be incompatible.
–
VatineJun 26 '11 at 7:22

1

If the ToS of Apple contradicts the GPL, having the copyright yourself will enable you to release it under more licenses, once under a license compatible with Apple ToS but also under the GPL.
–
Pieter BOct 31 '13 at 10:47

But I think the issue here is derivation. If your new work is derived from the GPL or LGPL work, then that work must adhere to the requirements of the GPL or LGPL. Your work will clearly be derivative, even if you completely rewrite it line-by-line in another language.

Yes, but does that therefor mean that you are not allowed to use that algorthim ever again? Does the fact that you have seen it implemented in another project forbid you from using that algorithm yourself, unless you could prove that you had the knowledge to come up with the algorithm yourself via other learning paths?
–
Chris BarryJun 24 '11 at 13:50

3

I am also not a lawyer so I'm just guessing. I wouldn't use the words "derived from" if you wrote your own implementation of an algorithm in another language. I don't think the GPL was created as a covert patent system.
–
Diego DeberdtJun 24 '11 at 13:51

1

@Seventh - you should trademark the term "Covert Patent System" and patent the concept.
–
MayoJun 24 '11 at 14:15

2

Algorithms are not copyrightable. For the purpose of copyright law, repeating an algorithm is not actionable. The point is whether your program is textually derived from the original or not; that means variable names, code layout etc. (Patent law, however, may or may not apply even to algorithms.)
–
Kilian FothJun 24 '11 at 14:19

1

The license covers the implementation not the algorithm itself. Porting the implementation to another language is a derivative work in the same way porting Harry Potter to Spanish would be. You are free to implement the algorithm in your own way. I would recommend no copy/pasty and learn the algorithm you want to implement and write your own version from scratch. IANAL.
–
Dave RagerJun 24 '11 at 14:23

As others say, this is likely to be derivative work and thus directly infringing the GPL terms if you choose to do it "separate from the original licence" (I assume that means you would remove the GPL and use something else, even closed source).

Even if it slips as "legal", it is clearly immoral. The author of a GPL'd software chose such a license that extends the freedoms onto derivative works. Be it a good or bad thing, it is the author's intention, and you should respect that. They gave you the code to read and modify, fork and whatever, only asking in return that you don't change the conditions. It's also likely that you weren't expected to pay for the software itself either.

I know money is difficult, but in this form as you paint your idea, it's stealing. Sure, you could have learned that algorithm or whatever implementation detail from another source, but you didn't, as said by yourself.

If morality doesn't concern you, then remember that given the grey legality nature of what you are doing (or about to do), it is very possible that the original authors would contact the Apple because of copyright infringement. So far, Apple was quick to remove such software that infringed GPL. Another possibility is a lawsuit.

If I were you, I'd consider either GPL-ing my own work (that is not such a bad thing!) or obtaining the knowledge by other means.

It seems there are apps that are GPL (wordpress app?). Are you saying that it's not OK to use an open source project to learn an algorithm?
–
Chris BarryJun 25 '11 at 0:02

No, I'm not saying that. I was referring to OP's idea of translating the same lines to a different programming language. Now, where does the derivation end and where does the original work start? This is not an easy question, but I'm pretty sure that merely reimplementing the same algorithm without modifications is derivative work.
–
Tamás SzeleiJun 25 '11 at 0:16

Yes it is not an easy question. It would also be interesting to know how much change would be enough to not be illegal. Changing viable names, white space? It feels kinda silly as that stuff would be so easy to change, especially if you understand the code and so can make good alternative names.
–
Chris BarryJun 25 '11 at 0:20

BTW the code is well commented, so it's really easy to pickup what it's doing.
–
Chris BarryJun 25 '11 at 0:20

Well just use common sense. Do you, as a programmer, think that changing whitespace and variable names is a sufficient change? Ultimately (in realistic edge-cases) court would decide about the legality.
–
Tamás SzeleiJun 25 '11 at 0:26

I am not a lawyer either. If you are concerned whether this is a legal issue then you probably shouldn't even be asking this question and just writing your own.

My personal opinion on the matter:

If you are taking the javascript code and rewriting it in a different language, that's called porting and is considered a derivative work. If you are writing your own version of the software and using the javascript code as a reference to learn how certain algorithms work then you are probably OK.

I would err on the side of asking a lawyer.

As an addendum, copyright law allows you to basically do NOTHING[*] with the published source code other than read it. The license under which the copyright owner has released it allows you certain additional privileges not provide by copyright law. Taking and using the code in ways other than permitted in the license is no different than taking and using any copyrighted works protected under copyright law without securing permission from the author.

How about trying to do the right thing and not steal someone's ideas? You could simply email the creator of the code and ask if you can base parts of your project off of theirs. Many people would have no problem with that. If they do have a problem with it, then even putting aside legal issues, why would you want to tarnish your reputation as a professional in the community? The fact that this question as phrased more or less as "What can I get away with?", as opposed to "What should I do?" is a bit troubling.

So are you saying it is not ethical to learn how to implement something from an open source project?
–
Chris BarryJun 24 '11 at 23:56

4

@Chris: It's not ethical to create a derived work from an open source project and release it for sale, contrary to the author's intent as demonstrated by the license. If you can't adhere to the license, and instead are skirting around it... ew.
–
Paul NathanJun 25 '11 at 4:02

1

I'm not trying to avoid the licence(why I asked the question), but I wondered what the situation was regarding issues like this. Is there a time limit or amount of difference between two pieces of work that will stop it being a derived work? Otherwise it seems that one cannot use knowledge that is learnt from studying open source code?
–
Chris BarryJun 26 '11 at 13:58

there's no stopping you from selling an application based on open source code. In fact, the definition of open source (given by the Open Source Initiative) explicitly allows this. But you need to comply with the license, which is the OP's dilemma. The terms of the App Store and the GPL conflict, which is the problem here.
–
Martin VilcansJun 26 '11 at 19:43

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ~Martin Golding

I'm not a lawyer, so I'm not going to answer like one. Besides, lots of other non-lawyer people have already offered their thoughts about the legal ramifications of your idea. And I'll skip the moralization / ethics debate.

If I were you, I'd be more concerned with the ramifications as a developer. It's a respect thing. Self-respect, especially.

Sure, we all go hunting for "How d'ya {implementation} in {specification}?" from time to time. That's where Stack came from, amirite? And that's how all of us found are way here, right? That's not what I'm talking about because that's not what you're talking about.

If I combined the stroke of genius + heroic effort = result worth presenting to the developer community as an open source offering in the first place, and people liked it enough to use it at all, I would drop dead of flattery. I'd be big time. Like John Reisig, or Mark Story. Little ol me. And then some chump came along and line-itemed my contribution so they can offer it commercially or native it into their commercial app? Drop dead.

Code is like handwriting. You can't change an app bigger than a matchbox significantly enough that another legit dev could not diff the two side by side and say "Wait a minute..." As a developer, I would be too embarrassed by the possibility that my peers, my colleagues, people I respect and whose respect I crave, would ever find out I jacked somebody's code. I'd be a laughingstock. Cos that is some epic copy pasta script kiddie bs. Do you really want to delegitimatize yourself in the eyes of your peers? Jacking code is a good way to start.

And as a developer, consider this: if that was my app, and I found out you jacked it such that you'd be worried about getting sued, what if I decide the hell with suing you, you're making a stack of cash thanks to my code anyway so why shouldn't I hit you where it hurts, maybe get some of that back? How do you KNOW I'm not an adolescent or possessed of a temper and a scary set of skills? Go out of my way to pwn r00[ on ur b0xen, so to speak. Since jacking my app would show me that me > you (basis: I could write what you could only jack). It wouldn't be the first time.

I really like this answer. I think the issue is if you can use the code as a learning point, and then re implement that. I think it's about a 200~ LOC script, so it's not that tricky. I just really wanted to start from a working example for my learnings, and so it seemed to make sense to start from there. If I wrote the whole thing in psudo code and GPL'd my port would that put me in a reasonable position? I really think the title of the post has sparked the debate more than I was expecting.
–
Chris BarryJun 26 '11 at 14:05

Re: sparking debate, consider the nature of the question: a professional dev pours her heart and soul into her craft whether she wants to or not. Hours of my time, buckets of blood sweat and tears because the nature of software is to be a beast. And on top of that, our craft is so difficult that truly excellent contributions to open source (js libs, php frameworks, etc) - at this point, who among us doesn't rely on open source to keep our heads above water, professionally? So this question like this is deeply personal for all of us whether we realize it or not.
–
satyrwilderJun 26 '11 at 19:56

That stated, I learned most of what I know from open source wizards like John Reisig and Mark Story and their gang of whiz-kids. JQuery is my little friend. CakePHP is my bread and butter. There is nothing at all wrong with this. Hence the difference between jacking and porting. This is what we're talking about when we say, we stand on the shoulders of giants.
–
satyrwilderJun 26 '11 at 20:03

If you re-write each line individually you may or may not be "copying" the lines.

But you are copying verbatim the ordering, overall structuring and inclusion of the lines. In other words, the sort of stuff that makes the work a "whole".

You're copying the part that says "this line should go here, this line should go there". This is a large portion of the overall algorithm.

Additionally, when a project is started, nobody knows what to include, what things are to be considered more or less important, how to structure and compose the algorithms. This information needs to be produced and designed at some point. But you wouldn't need to, because you'd be "copying" it.

As an example:

If I have a set {a, b, c, d, e, f}.

I can create an ordered list of them, [f, e, c, b, d, a]. You must say that I have added some information to the list, known as ordering, that wasn't present in the unordered set. Depending on the size of the list, this information might be very specific and hard to come up with.

It's like anything else - you cannot un-learn what you've learned, seen, read... but what you can control is how you use it...

Two things on this matter -

Like most licenses stipulations for Open Source Code ... making a dime on it is totally cool, making it "pseudo"-closed is cool - but the issue is 'credit'. I've purchased MANY scripts that have 'credits' given to (blog urls, OS code used..., etc..) but the issue is are you openly (not hiding) giving the creds/kudos to someone's creations (again, people don't mind if you do so... a lot of times people DO NOT give credit (thus violating the GPL type stipulations) for fear that people realize that they can get it somewhere else... but if your code is openly giving credit and can still stand alone (whether or not YOUR code contribution is closed/open) - then people will not care.

What i find as a developer is people want to not give credit, make it closed so as to mimic a great developer/coder, under the guise of making money on someone else's efforts....

so i digress to #2...

"intent" is almost (virtually) always the case... can you stand in front of a judge (say you were sued, brought to court, or asked to explain your actions for such) and state clearly without mumbling, and with distinct position on the issue - why you made the decision to hide/close off the 'open source' portion of your code, then this should not be an issue.

my 2 pence. :)

What's funny - is most people think they've invented a "specific idea" - when in fact, the "idea" has probably (extremely high probability) been already tossed around in the form of napkins, paper, coding, internet, blog, etc...

So, while it may be new to you, especially since you've seen it in someone else's OS works, it's probably used in other OS works that they derived their OS work from... and ultimately it's probably used somewhere else online... that's not even with a stated license/copyright issue at all... in which case you can copy from that source... modify, change, delete, add... (tho i'd copy/url to track back where you got it to show that you got it legitimately) to the code however you'd like.

I think it's amazing in 'code-land' especially how many times i've come to find that my 'crafty' code was already written (tho not as well.. mind you - lol) in 2003 on some person's geeky, google search rank of #1,239, website they made when they were in grad school, just creating functions for fun and free use. :)

Point is.. give credit, don't skirt the issue, and when all else fails... or if in doubt - ASK the original OS'r for use rights... yeesh! when did we get so arrogant that we cannot simply ask someone to use their weedwacker, shears, mower,... and - oh yeah - a cool function they made!

You cannot make derivative work of derivative work of derivative work ... and expect it to not be derivative work. It can become unrecognizable, but that's something else.
And you can start from any text and by serie of changes get any text (eg, remove first one, insert second one), so that its possible does not mean it was done.
So its not important whether something is possible, but whether it actualy happend (only impossible obviously did not happen)

Moraly speaking:
Learning from anything you can (legaly) get to is OK, but you should acknowladge sources.
rest is legality.

IANAL, but i would not think i made anything wrong, if:
1) I learned from open source implementation
2) Implement the same algorithm (even in same language)
by actualy doing this, large portions will naturally became totaly different, and
some will be realy similar.
If those similar parts are things where both sides followed same coding practice and thus
cannot be different, then these portions are imo not copyrightable. Eg. if class have two private String fields and they have getters and setters, only interesting thing is that this class have two read/write properties, not implementations of getters and setters.

if a legal complaint were to be filed on him, that would mean that someone would have to actually have access to the code and READ it. What if the software is compiled?

He'll always be able to call upon his ignorance at the moment at the moment of the facts. Ain't one supposed to have good faith before they're judged guilty?

Learning is not copying. Finding inspiration in some existing work is definitely not copying either. So what if he learnt from a piece of software the function of every line of code and decided he were to use the principles of the results to improve upon that and make a software that's better, simpler, leaner. Not copying IMHO.

Those were my 2 cents. Now is the turn to the first sinless one to throw the stone... ;)

For #1: Until your source code is subpoenaed by the judge and you sheepishly grin at the jury as they see your "rewrite".
–
Jarrod NettlesJun 24 '11 at 19:05

For #2: Copyright infringement is normally a civil matter, so there is legally no such thing as "guilty". If the preponderance of the evidence indicates that the OP infringed, that's all that's needed. For #3: That's not what the original question said.
–
David ThornleyJun 24 '11 at 21:25

(1) It's not hard to spot a blatant plagiarism without seeing the source code. Besides, we're not in the habit here of advising people on how to get away with illegal and highly unethical acts. (2) Ignorantia juris non excusat (ignorance is not a defense) (3) Rewriting line-per-line is not learning. Rewriting line-per-line is definitely not just finding inspiration either. It's blatant plagiarism, plain and simple. I won't rehash it all here, but there are boatloads of legal documents and precedent supporting this.
–
Greg JacksonJun 25 '11 at 10:10

OK, so if I didn't rewrite line by line, but understood the algorithm, and then re implemented it in my own way. Ie a one man clean room operation. Is that different? If not, am I therefor not allowed to learn from any open source project?
–
Chris BarryJun 25 '11 at 10:16

4

@Chris The whole point of a clean room operation is that people implementing the algorithm haven't seen the original source code at all. There's no such thing as a "one man clean room".
–
Anna Lear♦Jun 25 '11 at 20:57