Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm wondering if there is a common license that would be good for snippets of code (eg. things you might just paste into a file), which has the following conditions:

  • Modifications of this snippet must be open-sourced
  • No restrictions on code that uses the snippet

Or would this license be too prone to workarounds to exist?

share|improve this question
What is your goal? – Joel Spolsky Jun 28 '11 at 2:35
@Joel, making, a site for code snippets. Just toying around with different ideas at the moment, I'd like to know what's out there (following this advice) – luqui Jun 28 '11 at 2:56
I mean, what goal do you want the license to accomplish? – Joel Spolsky Jun 28 '11 at 3:03
@Joel, pondering it as a way to encourage people to fix bugs, etc. on the site rather than pasting it into their project and fixing it there, where it's no use to anyone. – luqui Jun 28 '11 at 3:07

Don't bother.

Make your snippets free as in beer, add a line that says "If this is helpful, let us know. If you do a modification that might be useful to someone else, you will improve your karma by making that mod freely available, just like these are."

The people who would observe the license clause about open-sourcing their mods will release the mods back anyway, if you just ask. Honest, ethical people are honest ethical, people, who do the right thing even when nobody's looking. The people who'd keep their mods private will do it anyway, whether the license allows it or not. Scumbags are scumbags and will always be scumbags, regardless of who's looking.

You can claim the copyright (if it is in fact yours to claim). That and a dollar gets you a cup of coffee. That and a whole lot of dollars lets you sue one (1) scumbag, and you'll probably never recover anything like the cost of the suit. Meanwhile, ten or twenty of his brother scumbags have crawled all over your site and are doing exactly what he did, and you then get to spend ten or twenty times as much money suing them as well.

Sometimes, you're better off taking the High Road and building good karma.

share|improve this answer
Yeah I hear you, thanks for making that perspective clear. – luqui Jun 28 '11 at 3:35
awesome answer :) – sebpiq Feb 13 '13 at 13:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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