How to correctly use code you didnt write
patrick-wied.at
patrick-wied.at
It should be titled: "How to correctly attribute code you didn't write"
I try to take the "when in rome" approach and if I'm messing with a class, I try to style it consistently (even though it may drive me nuts to do so)
I under-appreciated licenses for a very long time and only recently realized the very real risk of writing some code, posting it to github without any licensing, it being picked up by some commercial organization, and then them licensing it and (possibly, later) taking action against you for using their code without a license (ha!).
Anyway, I appreciate the spirit of the post, but it didn't make much of an argument...
Edit: I guess he also argues that it might upset the code's author to copy their code without attribution (totally possible), which would lead to their writing less open source code (seemingly less likely). I think the risk of commercialization of your code is more salient, though.
I am not completely sure about US copyright law. However, at least in the European Union, you are the sole owner of your code as soon as you write it. Therefore, anyone putting their license on your code would be violating your author rights.
That would just make me unethical, and you can't protect against that.
If they're so unethical to try and sue you for using code they just found on the internets without a licence, they're just as likely to steal your code even if it had an MIT licence and claim you were the original thief.
Independent of the specific license, I would suggest listing sources (and uses) of all external code in your LICENSE file, and at the header of each file. This makes it much easier to check for license compliance later on. Most open-source licenses require attribution but do not explicitly specify how this should be done.
Example: "check_for_update() from stackoverflow.com/... (CC BY-SA)"
Depending on the license of the code you are using, you might be required to mention its use in your application's documentation (e.g. BSD, CC BY).
If the code is in the Public Domain or is not sophisticated enough to be protected by copyright (thin ice!), there is no need to mention it in the source code.
If it is just a few lines of code, try to put it into its own function and add a short comment. This also allows you to easily remove problematical code later on.
Generally, if it is just a few lines of code, dealing with the license issues is usually not worth it. For example, you can not legally mix CC BY-SA code from Stack Overflow with GPL code. I would suggest just looking at the SO solution and writing your own implementation of the algorithm (not completely safe but probably the most convenient solution).
Also be aware of the original licensing for the code. If it's any more than attribution you'll need to determine how it affects the rest of your code and if you might need to reimplement.
If you're not interesting in (say) GPL'ing your code to match the 10 lines you lifted, you would be better of just reimplementing those 10 lines yourself.
If I'm using parts of someone else's code I'll have a comment preceding it explaining where the code is from (eg: // code taken from: url). It's a massive annoyance to have to try and copy in licenses in the middle of code, it's ugly and makes reading through my code a pain. I guess I'll go to hell for it, but eh.
E.g. if I write a plugin for a system (e.g. Wordpress) and I sell this plugin?
Does the plugin code needs to be distributed under the same licence as the original system even though it wouldn't distribute any of the code provided by the original system? It would only call functions or inherit from classes described in the original system.
The SFLC says that calling a function does make your code a derivative work of that function's code. I've never seen any analysis from them that explains why they think the video game cases don't apply. They are a free software advocacy organization--they naturally tend to take the most free software friendly interpretation possible of law, and I think that often takes them a little past what the law actually is into what they wish it was.
It would be interesting for someone to write a simple blogging system with a plugin interface that is compatible with Wordpress' plugin interface, and put it in the public domain.
Then anyone making a plugin could claim that they actually wrote it for the public domain system, and that is what they are a derivative work of rather than Wordpress. It would be amusing to see what the SFLC would make of that.
Something like this actually happened once, in the early '90s. Someone was distributing a secure email system that used RSA. It used RSA via the RSAREF library, which was freely distributable but not free software. The email system was distributed in source form. When you compiled it, you could compile it to use either the BSD arbitrary precision math library or GMP. Basically, the source had #if statements that selected whether it should assume the BSD library or GMP. (I believe GMP was under GPL, not LGPL, at the time).
Stallman didn't like this. The author of the email system then wrote a toy arbitrary precision library that had the same interface as GMP, and that satisfied Stallman.
Also you don't have to provide a free download to the general public. It's just that everyone to whom you distribute your code has the right to request the source code. You don't have to provide source code to people to whom you did not distribute the software. Of course anybody that you did distribute the software is free to put the source code up for public download.
There are sites that do that type of thing, I've had GPL software I've written show up on download sites and such. But if you are maintaining your software then they will often be out of date and hopefully you'll be showing up ahead of those in search engine listings for your own products. Basically if you're providing good value, you're less likely to be affected by that type of thing.