1

Samples coming with SDK are intended to provide best practices. So logically it looks perfectly valid to take code from them. But usually samples come under licenses, for example a lot of samples from Microsoft are released under Microsoft Public License (MS-PL).

Samples are usually published to provide best practices and common reusable code. But how can I use code from samples if they are under rather strict licenses?

2
  • What SDK are you talking about?
    – Adam Lear
    Feb 22, 2011 at 15:47
  • @Anna Lear♦ any. Silverlight examples come under MS-PL, Android SDK are under Apache License.
    – Andrey
    Feb 22, 2011 at 15:57

5 Answers 5

2

I've never been in a position where I wanted to copy & paste code from a sample directly into my app. What I usually do is I read through the sample and then re-implement it in my code. I am not a lawyer, but I believe it is then my code and not subject to the sample's license. Mind you, when I say I re-implement it, I don't mean just retype straight from the SDK's help page. I study the sample until I understand it fully and then I can easily produce the code I need.

1

The general advice I've received (from various company and institution policies) is to never copy code without express permissions, regardless of the source. It is not just the licensing problem, but also a copyright problem and can quickly become messy and costly to sort out.

0

Typically, from what I have seen you end up leaving the copyrights in place and provide appropriate documentation showing where you got it from. Much like an APA citation in a paper.

0

As with most standardised code, leaving the copyright information in tact is a good approach and where it is dominantly visible where it's being implemented. In most cases, contacting the original development team that created the code is somewhat a bit of a hassle and something you'd rather not do. After all, the sample code is for developers to use and modify - by 'modify' I would include implement too. Why deter people from using samples?

0

It's like with any other source code: either meet the terms of the license or do not use the code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.