views:

324

answers:

7

I was wondering what constitutes as fair use for code. For example, implementing a flood fill from pseudocode from Wiki. Or if a user here gives pseudocode, does your implementation of their pseudocode constitute as fair use or is this copyright infringement. What about a modification of a C algorithm? Where are the boundaries? Thanks

A: 

No Bounds unless the author stated so.

(and Even if he stated so, You can't enforce it, specially if the staff is out in the open).

There is no ethics here, but if you use someone else code/idea, at least tell him / give credits.

If the staff is copyrighted... or if the author asked not to use it.. than ethically you shouldn't, and in real life... you can use it on you own risk.

Dani
-1 IANAL, but at least in the United States, code is considered a copyrightable literary work: see http://www.law.cornell.edu/uscode/17/101.html. I strongly recommend consulting a lawyer before using any code you find on the internet that doesn't come with an explicit license.
@user168715 - For start, I do not live on US. 2nd if you post something on the net without any copyright or restriction - you can't sue anyone that uses it. If you put 100$ on the street and a dude takes it - you can't sue him in court for theft - as you did not do anything to avoid it and by putting it in the middle of the street one can assume it's lost and take it.So - if you want any chance protecting your code (and that wasn't even a code - but pseudo code) - tell the reader that the code is copyrighted, and not to be used without permission. otherwise... you can't really protect it.
Dani
@Dani: "if you post something on the net without any copyright or restriction- you can't sue anyone that uses it.": That's completely false in most jurisdictions.
That's not true. In the United States, all substantial creative works (which is software is considered) are copyrighted automatically on creation. The author of the work is given by default an "All Rights Reserved" license, and until that license is explicitly revoked, it remains intact; suggestion and innuendo about the availability of the code does not have legal bearing on this and you'll have to prove that your use was "fair" to a judge to avoid penalties, even if a copyright holder posts their entire work online.
cookiecaper
The thing I'm wondering is, things like floodfill are used in lots of commercial software so is that fair use? Some code has to be implemented a certain way.
Milo
There are "well known" algorithms that are either public domain or are so widley used that retrospective enforcement of copyright or patent or other ownership rights would be unlikely. If you invent something new that is not "obvious" to anyone knowledgeable in the state-of-the-art, it may in some cases (and jurisdictions) be patentable. Copyright is a different issue, relating to the verbatim written expression. Plagiarism is a different issue again, claiming someone else's work and ideas as your own, no matter how you may have disguised or modified the work. [I am not a lawyer]
Clifford
It's also incorrect to say that leaving your property out in the street means it is not theft if somebody else then takes it. It might be so in some jurisdictions but certainly not everywhere (e.g. be careful about selling any iPhone prototypes you happen to find lying about in a bar).
JeremyP
So, If I give someone an answer here on SO, with a great idea and some psuedo code, is it automatically copyrighted in the United States ?I don't know US law, but I beleive the law you are quoting is referring to something like taking code from your company and using it elsewhere. in this case I can understand the automatic "copyright", but for a pseudo code posted on a website... (and the internet is not the 52 country of the united states.... I don't see any way to prevent someone from using that pseudo code.
Dani
@Dani, yes the copyright on anything you write is automatically yours under US copyright law (and others, see the Berne Agreement http://en.wikipedia.org/wiki/Berne_Convention_for_the_Protection_of_Literary_and_Artistic_Works). However, the terms of use of this site (which you read when you signed up, yes?) require you to licence anything you post under a Creative Commons Licence.
JeremyP
+2  A: 

I don't know about the US, but here in Europe algorithms are not considered intellectual property. Taking an algorithm and implementing it yourself is therefore always allowed.

Emil Vikström
Algorithms are not protected here, but sometimes implementations of these algorithms can be protected. Often, this practically makes algorithms protected. USPTO is ignorant on all of this and grants patents left and right that are obviously invalid to anyone associated with the field.
cookiecaper
+5  A: 

Almost unanswerable without a specific example, and each situation may be different.

If the code has associated license terms, you should abide by them. If code of any kind is posted here, I don't think anyone could reasonable expect any protection, it is essentially in the public domain. If one did not accept that it would be used, why would one have posted it here!?

Code can be copyright, in some parts of the world it cannot be patented. On the other hand in other regions, software patents are granted.

[edit]I am not a lawyer, none of the above should be take as license for any action whatsoever.

Clifford
Code does not become public domain just by posting somewhere, even if there is an obvious intent for public consumption and usage. The copyright is still active and if someone brings suit, you'll have to argue that there was no reasonable expectation of protection. I am writing this so that no one takes this comment too literally and assumes that publicly exposed code becomes free game. You also have to worry about misappropriations, i.e., an employee posts snippets without authorization of his employer, employer brings suit on those who use the snippets.
cookiecaper
Note that as per the Stack Overflow terms of service, all code we post here is licensed under Creative Commons Attribution Share-Alike.
@cookiecaper: "The copyright is still active and if someone brings suit, you'll have to argue that there was no reasonable expectation of protection." You probably mixing the copyright with the authorship. As per @user168715, all code posted in SO is under CC. That means by fact of posting a piece of code here you give up some right, regarding copyright protection. It's authorship which cannot be given up or transferred.
Dummy00001
@Dummy00001, the terms may say that, but that doesn't necessarily automatically make all code posted here fall under that license, either. Again, if someone misappropriates code, CC-BY-SA cannot apply because misappropriator does not have authority to change the license from All Rights Reserved. This code would be on Stack Overflow but would not legally be usable under CC-BY-SA as far as I understand.I was not aware of that stipulation in the SO terms, however, so it's nice to know and applicable in some situations, but not universally. Always better to get explicit clarification anyway.
cookiecaper
All good comments; in the end when using code that is not your own, exercise caution and due diligence. Not only for reasons of 'ownership', but also because it may just be bad code!
Clifford
Licensed use under Creative Commons is totally different from "fair use".
Ben Voigt
+1  A: 

It varies by jurisdiction. Here in Canada, the moment you write something, that particular bit is subject to an implicit copyright granted by our copyright law to you. However, it doesn't cover translation from one thing to another, unless that is your only source. In addition, with our new copyright law about to be passed, under the digital locks provision, you would not be allowed to translate psuedo code into actual code, as that could be argued to constitute a digital lock, which trumps the education fair dealings provision.

All this said, if you do not see any terms and conditions, one thing can be guaranteed the "safe bet" for all jurisdictions -- Don't use it. In my jurisdiction, if it comes with no terms, even if it's on this website, no express permission has been granted to use it.

jer
Express permission to use code on this Web site appears in the copyright message at the bottom of every page.
Rob Kennedy
A: 

Well I'd imagine that if you look at the history of applications, you'll find a lot of it is about stealing code.

I mean Windows stole a lot of things from the freeware market in their OS and make people pay for it. Yet they're so massive and large, that nobody can really go against them with a claim. Only the Java/IE crisis years back was the biggest one.

On top of that in the 80s, you can bet a lot of things were based on previous technology. Things like popular Database and Word processors applications, were all software that were previously made by someone else.

So basically I suppose if you find something, use it! Can't really say that just because you used someone else's idea that it's automatically theirs and theirs alone.

Daniel
A: 

As others have said: (1) rules vary according to jurisdiction; and (2) the details of what you do are likely to be quite important.

I can certainly give you some idea of what the position is from the point of view of English law:

[1] Software is subject to copyright.

[2] There is no such thing as "fair use" (unlike the situation in the US).

[3] Copyright protection extends beyond stopping you making a copy, but includes preventing you making adaptations, which would include (for instance) translating the work into another computer language.

The idea we have "fair use" of any kind is a common misconception. Fair use is a fairly broad idea in US law. The equivalent in English law is a specific list of exceptions where you are allowed to use a work, provided that in addition what you do is "fair dealing". You can find a long list of them in Chapter III of the Copyright Designs and Patents Act 1988 (caveat: that is the act as passed, not as amended).

Your real question is not (I suspect) "is this fair use" but "can I do this?" and that's a more complicated question - which is why others have said you should consult a lawyer about it. I'd agree, but that might seem rather self-seeking (since I am a lawyer specialising in copyright).

But there are other questions, for example: to what extent is taking some pseudo-code and realising it in a programming language an infringement of the original work? Its going to be a matter of degree, but exactly where the line is drawn is not an easy question to answer, and of course impossible in the abstract. Most of our reported cases concern very substantial violations, including taking thousands of lines of code and then using automatic tools to hide the fact that it was copied, eg by renaming procedures.

If by "from Wiki" you mean "on Wikipedia", then that is licensed under CC-BY-SA 3.0. Unless there is something to suggest otherwise, it is probably reasonable to assume that the pseudo-code was written by an editor and is fine to use.

As others have said, just because something appears on a website with a permissive license, does not mean that someone else (who hasn't given permission) doesn't own the copyright. In particular if the work was done in the course of employment, the writer's employer will become the first owner of the work. However s97(1) of the Copyright Designs and Patents Act 1988 is likely to give you a defence:

(1) Where in an action for infringement of copyright it is shown that at the time of the infringement the defendant did not know, and had no reason to believe, that copyright subsisted in the work to which the action relates, the plaintiff is not entitled to damages against him, but without prejudice to any other remedy.

Of course I am talking here about copying code or pseudo-code not about the underlying algorithm. Of course where the algorithm ends and its expression as code begins is something that we argue about a lot and where there is no neat line.

A final point: this is an area of law where, I know for a fact, the English courts have deliberately departed from the approach of the US Federal Courts. If you are interested in how things work here, be very cautious about accepting advice, however well meant, from someone not familiar with the UK.

EDIT I realise that I was looking at the wrong individual when working out where the questioner lived. My apologies. The above may be useful for anyone who is in the UK.

Francis Davey
A: 

Preface: IANAL

Writing your own code to implement an algorithm is generally OK (by US rules). An algorithm is essentially a generalized mathematical procedure, and US patent law defines math and science formulas as "laws of nature" which are not patentable. Your specific implementation of it can be copyrighted (so people can't duplicate your binary), but if someone else wants to write their own code from the same algorithm there's not much you can do to stop them. Example: if I write a physics engine, you can't copy it; however, you can write your own engine that duplicates the functionality of mine. Nobody can claim ownership over the laws of physics so the basic rules that the engines follow cannot be patented. However, my original work (the source code that implements those rules) belongs to me and I can copyright it accordingly.

If you are working (as you mention) from general algorithms or pseudocode listed on this site or on Wikipedia, then you should be okay (for the most part). Content posted here or published on Wikipedia is automatically licensed under open content licenses that permit others to use the content (see each site for the exact licenses used). As long as the poster wasn't posting code that they didn't have permission to redistribute, then content from these sources is okay to use.

You mention "modification of a C algorithm". If you meant "modification of an algorithm", then the statements of the first paragraph apply. If you meant "modification of a piece of C code", then you will have to check the original code's license. Some source code is licensed in a way that allows unrestricted re-use and modification, some allows modification if you meet certain conditions, and some does not allow modification at all. If the source code you are working from did not include a license, either contact the author and ask for permission or check the terms of the website where you found the code (some include a license that covers all code on the site).

If you even have the slightest doubt about whether you can re-use a piece of code, don't do it. Playing it safe and taking some extra time to work out the code yourself is infinitely more preferable to saving some time and effort now and getting the pants sued off of you in the future. If you really need to find existing code that you can re-use, look either for code written by the US government, it's agencies, or university research projects funded by government grants (all such code is required to be placed in the public domain) or open-source code published under a permissive license such as the BSD license.

To give a sense of how complicated these issues can get, here are a few links to articles describing fair use in the context of software.

bta
Awesome thanks!
Milo