views:

485

answers:

7

I'm building a library from methods that I've found on the internet. Some are free to use or modify with no requirements, others say that if I leave a comment in the code it's okay to use, others say when I use the code I have to attribute the use of someone's code in my application (in the credits for my app I guess).

What I've been doing is reorganizing classes, renaming methods, adding descriptions (code comments), renaming the parameters and names inside the methods to something meaningful, optimizing loops if applicable, changing return types, adding try/catch/throw blocks, adding parameter checks and cleaning up resources in the methods.

For example;

I didn't come up with the algorithm for blurring a Bitmap but I've taken the basic example of iterating through the pixels and turned it into a decent library method (applying the aforementioned modifications). I understand how to go about building it now myself but I didn't actually hit the keystrokes to make it and I couldn't have come up with it before learning from their example.

What about code people get in answers on Stackoverflow or examples from Codeproject? At what point can I drop their requirements because at n% their code became mine?

FWIW I intend on using the libraries to create products that I will sell.

+1  A: 

You may like to know that (original) code contributed by users here on Stackoverflow is shared under this Creative Commons license (mind the attribution!).

For the others: try to find out (by mailing the authors for example) what license the code is under.

When someone else's code turns into 'your own' by modification: very tricky to answer...

ChristopheD
A: 

If you intend to take it "1-to-1" then you can't silently do it. Always check with the author, what he requires. He may give it out on no conditions, he may require attribution, he may allow free use except in commercial projects, whatever. Always check out.

What is more, that even if you're clean right now, there is a danger some of the guys might change their conditions all of a sudden. If you're not monitoring them all, or if you don't have a permission protecting you from future license changes, then you may well face an issue.

Developer Art
+3  A: 

The correct answer is ask a lawyer, it varies by country.

The probably-less-correct answer is that you're dealing with a copyright issue. Assuming that you're in the US, everything someone writes is considered to by copyrighted from when it is created. Those notices that allow you to reproduce under certain conditions are a form of license that allows you to use a copyrighted work under certain conditions. If you're going to redistribute for profit, and don't have explicit permission to do so, then you need to have a work that is copyrighted to yourself. I'm not sure if it is possible to create a derivative work (which is what you are doing) that is far enough from the original material to no longer be covered by the copyright on the original material.

tloach
Yeah, good point. If Nascar can call something a Chevrolet (insert relevant model here) when the thing bears no resemblance to the actual production car then I guess I can never call keystrokes someone else typed mine. Even if there is only a single keystroke left from the code I started with.
robault
+5  A: 

'Found' code, no matter how you dress it up or switch it around, will always be found code and if you present it as other than that, e.g. Hey! look what I made!, you are probably misrepresenting.

The best approach is to learn from found code and implement yourself, then you can confidently place a license of your own.

Sky Sanders
+1  A: 

In a legal sense, it depends on the license under which each piece of code is released. That will determine whether or not you can modify, distribute, share, etc the code in the first place.

In a philosophical sense, I would say code becomes your own when you understand the concepts so well that you can (and do) write it from scratch without refering to the original code. But that is a more subjective point.

KarstenF
+10  A: 

It seems most of the answers miss the point. The question isn't about licenses. It is about when someone elses code becomes yours. The answer is, in general, never. You can modify it, improve it, incorporate it into a larger work, etc, until none of the original code is left. But the result is still a derivative of the original. This is quite seperate from the question "Does the original author let me do this".

KeithB
Thanks for pointing that out. A few answers did miss the point a little. I guess the only real answer is take what you know and start mashing keys until you come up with your own work.
robault
But if none of the original code is left, it is indistinguishable from code I wrote from scratch, which is entirely mine. If nobody can tell the difference, how can the law treat them differently?
meriton
The law isn't amenable to ordinary logic. There is a style of development called clean-room development (http://en.wikipedia.org/wiki/Clean_room_design) that deals with this very thing. One group of developers examines code to develop specifications on how it works, and gives the specs to a second set of developers to implement. That way there can be no claim of copyright infringement, since the people who wrote the code have never seen the original source.
KeithB
A: 

First of all, if the code on the website is very small and trivially simple, it may not qualify for copyright at all. In this case you can ignore any copyright notices that it may have and simply use the code. This is the reason why Hello World, matrix multiplication and other such things are free of copyrights. However, using just a small part of a larger complex work (e.g. take matrix multiplication from a math library) does not allow you to escape the copyright of the original.

A work gets automatically copyrighted even when there is no copyright notice. If there is no mention of a license, you cannot use the work (a license gives you rights to use it and by default you do not have such rights).

You may claim a derived work as your own (and thus dismiss the original copyright) when it has been completely rewritten so that the original work can no longer be recognized from it.

I think these apply pretty much identically to most countries in the world (because of international trade agreements), but I am only aware of the Finnish legislation and I am not a lawyer.

Tronic