27

I share small snippets of code with friends, and would like to post them online for others to use.

I'm not sure of the best license?

I was thinking MIT, but it includes this clause:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

These code snippets are not very big, not enough to justify adding an entire license screen. And there is no "read me" or "license" text file distributed along with a mobile app.

I'm not going to change the user interface of my app, just so I can turn three lines of ugly code into one line of clean code.

Is there an open source license that does not require the license to be bundled with binary copies of the app?

Or perhaps I should use MIT and delete that one clause?

5
  • 5
    Note: I asked this 4 years ago on SO with good results but it was closed a few weeks ago as off topic. stackoverflow.com/questions/6052517/… Commented Jul 6, 2015 at 21:39
  • 4
    It's most definitely on topic here. Commented Jul 6, 2015 at 21:44
  • 1
    What do you expect from the license, i.e., which freedoms/restrictions do you want? Copyleft? Attribution?
    – unor
    Commented Jul 6, 2015 at 21:46
  • 3
    @unor I expect my friends and other people to be able to use the code without worrying that I will sue them later for copyright infringement. No restrictions. Commented Jul 6, 2015 at 21:48
  • 1
    Related question: opensource.stackexchange.com/questions/504/…
    – kdopen
    Commented Jul 6, 2015 at 21:54

4 Answers 4

10

It looks like you want a permissive license. Perhaps, you could use the unlicense?

From their site:

The Unlicense is a template for disclaiming copyright monopoly interest in software you've written; in other words, it is a template for dedicating your software to the public domain. It combines a copyright waiver patterned after the very successful public domain SQLite project with the no-warranty statement from the widely-used MIT/X11 license.

As such, you would be able to license your code, placing little to no restrictions on it.

8
  • 4
    See also WTFPL, which puts it a bit more bluntly.
    – domen
    Commented Jul 7, 2015 at 8:13
  • 2
    @domen I was going to suggest that actually. It's an... interesting license
    – Zizouz212
    Commented Jul 7, 2015 at 12:32
  • 1
    @jkdev Ah, but you are wrong. The reason CC0 is not approved is due to the fact that software patent rights are not given up. This is why I recommend the Unlicense, an not necessarily CC0. Fundamentally, both licenses due the exact same thing: dedicate code to the public domain under the full extent they can under the law.
    – Zizouz212
    Commented Oct 16, 2015 at 1:39
  • 2
    @jkdev and CC0 is also a license :)
    – Zizouz212
    Commented Oct 16, 2015 at 11:23
  • 1
    Technically it's a hybrid -- it contains a permissive license as a fallback, in case the software cannot legally be donated to the public domain. (The Unlicense is like that as well.) Copyright is automatic in the U.S. and many other jurisdictions, and whether it can be voluntarily removed is often unclear or downright impossible.
    – jkdev
    Commented Oct 16, 2015 at 17:43
13

It seems that you don’t need a typical FLOSS license at all.

If you want to let everyone use the code snippets and allow them to do whatever they want to do with them (which includes publishing these snippets themselves without explicitly granting others the freedom to use these), without having to attribute you and without having to reference a license, then you could release the works into the public domain.

As this is not possible in all jurisdictions, there are legal tools that try to "simulate" the public domain to the greatest extent allowed by the respective laws.

A popular one is CC0 1.0 (it’s approved by the FSF, but not approved by the OSI).

You would just have to include something like this somewhere, e.g., in your site’s footer or your Stack Overflow profile:

To the extent possible under law, I have dedicated all copyright and related and neighboring rights to code snippets (posted on http://example.com/) to the public domain worldwide. See CC0 1.0.

(Here’s what CC and the FSF recommend to write; it’s, for example, recommended to mention your jurisdiction. CC offers a tool that outputs a possible snippet.)

Now everyone can use the snippets in any way (but it doesn’t affect your possible trademark or patent rights), without having to reference CC0 1.0 and without having to attribute you.

13
  • 1
    I feel like I should be clear here, but Creative Commons licenses aren't intended for software. Also, they're not OSI approved, for the other side of this
    – Zizouz212
    Commented Jul 6, 2015 at 22:14
  • 1
    @Zizouz212: Neither Creative Commons itself agrees with that (CC says that CC0 is suitable for software), nor the FSF (CC0 is a GPL-compatible Free Software license). ··· And yes, CC0 is not approved by the OSI (see their FAQ about it), so it’s not an Open Source license.
    – unor
    Commented Jul 6, 2015 at 22:22
  • @Zizouz212 CC0 is definitely intended for software. It can and should be used where appropriate. Other creative commons licenses should not be used. The only confusion comes from people assuming that "creative commons" is a license when it's actually a group of several licenses. CC0 hasn't been formally approved by OSI as an open source license but it does meet all of their requirements and probably should be approved by them, no doubt they will get around to it one day. Commented Jul 6, 2015 at 22:24
  • @unor: I don't think approval of the OSI is strictly needed for an open source license, complying with the definition is enough.
    – Mnementh
    Commented Jul 6, 2015 at 23:14
  • 1
    @unor: opensource.stackexchange.com/q/895/55
    – Mnementh
    Commented Jul 6, 2015 at 23:35
3

Another contender: the Zero Clause BSD License (0BSD), also called the Free Public License 1.0.0.

It's similar to the ISC License, except that there's no requirement to redistribute the license's text.

Here's the original 0BSD license, as used for toybox:

Copyright (C) 2006 by Rob Landley

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

0BSD / Free Public License 1.0.0 is approved by the Open Source Initiative, but is not mentioned by the Free Software Foundation.

Hat Tip: This answer to a related question, specifically dashesy's comment mentioning 0BSD.

5
  • Calling it "0BSD" or "Zero-Clause BSD License" is somewhat confusing, though. The ISC License has been used for OpenBSD and sometimes goes by the name "OpenBSD License," but it isn't actually related to either the original or modified BSD License.
    – jkdev
    Commented Oct 16, 2015 at 7:46
  • While I'm not discrediting this license (ISC), I want to raise up the issue of license proliferation here. This is arguably a copy of the MIT license, and the issue of having multiple, incredibly similar licenses only adds to confusions when people choose licenses for their products. It seems that you recommend the '0BSD' license, which you note is not open source.
    – Zizouz212
    Commented Oct 19, 2015 at 1:24
  • OSI and FSF don't list 0BSD as open source. That might change if it becomes widespread, like if bloggers apply it to all their code snippets... Or, does an "open source" license by definition require itself to be redistributed? (Maybe that's another question topic.) And you're right about open source / public domain license proliferation. If you go by the SPDX License List there are over 300 (including 0BSD, which was added earlier this year).
    – jkdev
    Commented Oct 19, 2015 at 5:54
  • This is a nice, terse license. Thanks for sharing it here as it feels very appropriate for code snippets where modifications should not lead to license proliferation as a result of the license being able to be removed assuming I read the rationale correctly.
    – vhs
    Commented Jul 3, 2017 at 6:10
  • 1
    Update: 0BSD, also called the "Free Public License 1.0.0," has been added to the list of licenses approved by the OSI.
    – jkdev
    Commented Sep 24, 2017 at 19:39
1

You talk about "snippets", thus presumably minimal stretches of code. Whatever you stipulate, they might fall under minimal pieces of the work under consideration, too little to be considered a "substantial part" triggering copyright. Besides, short snippets probably describe a way of doing something that can't be done in any other way, thus non-copyrightable to start with.

I am not a lawyer, and don't pretend to be one on random web sites either. To make sure, a real lawyer retained by you would have to review much more of the case.

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.