-42

My employer requires that I add a license header to code I post on Stack Overflow. It would be good if it had an option to automatically add such a header to all new questions and answers.

Here are some examples of questions and answers that already do this.

7
  • 14
    That would add a lot of noise to every post that nearly no one would care about. Commented Oct 12, 2020 at 17:14
  • 36
    You do realize that by posting code on SO, you are in fact licensing is as CC BY SA. Adding your own license doesn't change that fact. Essentially your code is now dual licensed with or without the header. So as long as a user copying your code applies by the rules of CC-BY-SA, your other license is meaningless, Commented Oct 12, 2020 at 17:20
  • 1
    @CertainPerformance Some very helpful questions and answers already seem to be doing it (and there are no comments about it on the ones I checked) and I don't see an explicit rule that says not to. Why not make it easier?
    – aviraldg
    Commented Oct 12, 2020 at 17:24
  • @psubsee2003 I am not a lawyer. I don't particularly care about the licenses the code is effectively under. The guidance says to add the header, and not specifically that the code must be only under a specific license.
    – aviraldg
    Commented Oct 12, 2020 at 17:26
  • 11
    Let's cut through the noise a bit, your employer is telling you that you can't post to SO. Commented Oct 12, 2020 at 21:29
  • 1
    FWIW, Creative Commons recommend against using Creative Commons licenses for software. See here for details. We use CC-BY-SA licenses here because Stack Overflow posts are effectively a form of documentation that (may) contain code samples. They are not intended to be a primary software distribution mechanism.
    – PM 2Ring
    Commented Oct 12, 2020 at 23:08
  • 5
    I guess an alternative solution is to write your own personal modified code that isn't related to your employer's code so that you can deal with it as your own code, not your employer. Otherwise, I'm not sure why your employer imposes such a rule even for your own code, or don't post it on SO...
    – Andrew T.
    Commented Oct 13, 2020 at 12:38

3 Answers 3

20

The vast majority of people don't use anything like this, so I don't see the point. Before you linked to it, I don't think I'd ever seen any example of someone doing this. In fact, your search returns only 51 posts (which is tiny compared to the total number of Stack Overflow posts).

As it is, I really don't see a lot of evidence that this feature is required for the general user base. That being said, if you'd like, you could always write a userscript or something to do this.

12

There was already a big bruhaha with the move to CC-BY-SA, such that posts and their revisions now have different versions of the license depending on when they're created. Having a feature where users can add additional licences would make things more complicated:

  • Not all licences are compatible with CC-BY-SA.
    Doing this would require Stack Overflow to maintain its own list of allowable licenses.
  • They'd have to do the same version tracking they now do for the site's license with whatever license(s) the user adds.
  • It would imply some responsibility on the company to explain the meaning of any particular combination of licenses on a post.

I don't think this change would be worth it from their perspective.

2

Would you be willing to post in your free time under a different account?

If yes, problem solved. Just create another account and contribute in your free time using your own code.

If not, does your employer ask you to use a license header that's incompatible with the content license here?

For example "All rights reserved", "Only for non-commercial use", "Not for Martians", ... would be incompatible with the content license (currently CC-BY-SA-4.0) here. In that case, your employer told you not to use Stack Overflow.

If yes, even without an automatic tool you can still add these headers manually, but ...

Copyright notices in code definitely add noise to the content and lower the value. Why should we want to encourage that? We have to live with these notices (see Should copyright information be removed from code? (in questions or answers)) but we are not really thrilled to see them.

So, no, please don't implement this.

You must log in to answer this question.

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