3

From what I understand, code that doesn't have a license associated with it is considered copyrighted by the original author implicitly (and technically no one has been granted any rights to use the code). Therefore, it usually is in the best interest of others for an author to license code intended to help others. Typically permissive free software licenses such as the MIT License is a good fit for these types on things. That said, should code snippets/examples be licensed on sites like this? Or is that not necessary?

If the answer is yes it should be licensed, then why not include the ability to attach a license to code examples provided as an answer to a question.

1
  • 7
    note that the code gets currently already licensed under CC-Wiki, just as all the other content. Whether this is sufficient for code is a different question though
    – Pekka
    Commented Mar 8, 2011 at 14:19

1 Answer 1

5

As @Pekka points out all content on SO gets licensed as CC-Wiki - so really this feature is required if that license is insufficient for code snippets.

If SO had lots of long technical articles explaining the implementation of some feature or other then that would be an issue. On sites like Code Project this would be relevant and they use The Code Project Open License (CPOL) 1.02, main points:

  • Source Code and Executable Files can be used in commercial applications;
  • Source Code and Executable Files can be redistributed; and
  • Source Code can be modified to create derivative works.
  • No claim of suitability, guarantee, or any warranty whatsoever is provided. The software is provided "as-is".
  • The Article(s) accompanying the Work may not be distributed or republished without the Author's consent

But as the answers to questions that contain code snippets on SO are too short to really constitute licensable software I can't see that explicit licenses are necessary. I would suggest that if a piece of code published as an answer on SO is so groundbreaking that it requires additional licensing then it probably shouldn't be used.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .