What is the guideline on creating a program or part of a program based on a non-free code, for example from codes Microsoft's sample code for .net or code found in someone's blog? The codes are there to help a programmer's work right? If one feels that part of such code is helpful in his work, does he have to reimplement them from scratch, or is it okay to copy and paste some codes? What is the limit?
In addition to the general advice of "go ask a lawyer," here are some other thoughts.
I am not a lawyer, but I am responsible, as a senior product line manager, for making the decision of when to discuss something with a lawyer.
If you work at a company that has staff lawyers, then it is always a fine idea to go talk to them. Usually you'll want to discuss with your manager first. If you're in a product development group then you should also talk with your product manager.
Generally speaking, there is no such thing as public domain code. Rather, every bit of code should have an license.
Re: can I use Microsoft sample code? Yes, as their web page says: The .NET Framework documentation includes code examples that you can copy directly from topics and paste into your own projects.
-- Quoted from their web page that you referenced in your original question.
Added: The one liner from the MS site is a summary of their license. The actual license is longer and refuses responsibility for what the code may or may not do, suitability, etc etc. But the one line summary, especially for sample code, is clear enough.
Re: can I use code samples from blogs Yes and no. Blogs should include a license for their software postings. Some do, many do not. If they don't, consider writing to the blogger and asking something like Which license covers your software examples from your blog? The BSD license (example from Yahoo: http://developer.yahoo.com/yui/license.html) or similar?
The reason you'd suggest that the blogger consider the BSD license is that it is very open. But, for example, the blogger could come back and say, "My examples are licensed under GPL 3."
In that case, you'd be bound by GPL 3 if you use the blogger's code.
Added: Can I use software examples from StackOverflow? Per the above, you should look for a software license from the blogger. And guess what? There is one for Stack Overflow. See the Legal link at the bottom of each SO page. On the Legal page, see section 3, "Subscriber content." That section gives you the license for all code samples on SO.
Conclusion If you want to be living within the licenses from the sw writers, then you need to know what those licenses are. If you don't know, then you run the risk of not actually having the right to use/re-license the software.
A different question, is "must I always have a proper license for software that I'm using?" The answer to that question depends on many things. The simple answer, especially if you work for any government, public or private institution is "yes." And, of course, as a proper member of society, you should also only use licensed software, for the obvious reasons.
Suppose, for instance, you see some sample code on a blog. The code is very useful to you. You want to use it. But there is no license for the code on the blog. You write the blogger, but get no reply. Can you use it? You could, but there is a risk (probably small), that the software's owner (the blogger) could decide to sue you. So then the real question is, should I assume the business risk? That's a business decision, not a technical decision. A reasonable business decision might then be, "Yes, let's use the software and take the risk of a problem."
Added: Microsoft Public license-- Microsoft (MS) licenses its sample code via its "Microsoft Public License." Also known as the Ms-PL. The license. Example of a .Net sample referring to the Ms-PL. Another example of Microsoft sample code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With