I have this portfolio website containing some personal projects/algorithm implementations. I want to get attribution if and when other people use my code or snippets of it. I initially thought of using Creative Commons but, as CC itself points out, CC doesn't fit well with software/code distributions. I would've used CC0 but CC0 does not enforce attribution.

So, is there a way for me to enforce attribution on my code ala CC? Including a copy of a FOSS license with every code distribution I have seems overkill---the license itself might be longer than some of my codes. Will copyright claims on top of source codes work if I say there that attribution is required?

  • 1
    If you want to allow usage under certain terms, you gotta specify these terms. And it takes some lines to state these terms unambiguously. Besides that, if your code is shorter than the 14 lines of MIT (the shortest widely-used one I'm aware of, but 2-clause BSD is still 25 lines) is it even original enough to pass the threshold of originality, much less be worth attribution?
    – user7043
    Dec 29, 2011 at 9:01
  • @delnan "If you want to allow usage under certain terms, you gotta specify these terms." Sorry if I sound so newbie but are you saying that all I need is to specify my terms and people who use my code will have to respect it (so long as it is reasonable, of course)? Also, thanks for mentioning the MIT and BSD licenses---I didn't know they're that short.
    – occlean
    Dec 29, 2011 at 9:15
  • 1
    As you can read in various other questions here, the default is fully copyright with "all rights reserved" (if copyright applies at all). Every right you grant beyond what's allowed by default (very little, and even that may depend on which country you're in) has to be granted and communicated somehow. And for strangers you never meet, putting it in the source code is by far most reliable for everyone.
    – user7043
    Dec 29, 2011 at 9:36

1 Answer 1


Don’t include a copy of the license then, just name it, and as a curtesy, provide a link. For instance:

// This code is licensed under the BSD license.
// The license text can be found at
// http://www.opensource.org/licenses/bsd-license.php

This should be fine.

If it’s particularly important to you, separately mention that you’d like attribution for usage of the code.

  • The only issue with this is if the link becomes invalid at some point in the future.
    – Bernard
    Dec 29, 2011 at 16:35
  • 1
    @Bernard, I've thought of a workaround to that though it may be specific to my case: Since I'm making a portfolio website, why not host a copy of the license on my own server? I'll just indicate the "mirror link" in my code.
    – occlean
    Dec 29, 2011 at 16:56
  • @occlean: Not a bad idea.
    – Bernard
    Dec 29, 2011 at 17:26
  • And make sure your copyright notice is in each file. Dec 29, 2011 at 17:45
  • @Bernard That should never happen in this case. Links to the OSI licenses are all over the place, they’d need to fuck up pretty badly to make all those links obsolete (and yes, having .php in the resource name is embarrassing). Dec 29, 2011 at 23:34

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.