Question

It's a common practice to place copyright notices, various legal disclaimers and sometimes even full license agreements in each source file of an open-source project. Is this really necessary for a (1) open-source project and (2) closed-source project? What are you trying to achieve or prevent by putting these notices in source files?

I understand it's a legal question and I doubt we can get a fully competent answer here at programmers.SO (it's for programmers, isn't it?) What would also be interesting to hear is, when you put legal stuff in your source files, is it because "everyone does it" or you got legal advice? What was the reasoning?

Was it helpful?

Solution

Is this really necessary

No. It's not legally required. (I am not a lawyer, but I've seen this stated by one.)


If you've got a project where individual files might be taken out of context, it may be sensible - but it only requires a couple of lines, to say something like:

This file is part of <project> which is released under <license>.
See file <filename> or go to <url> for full license details.


For anything else, you can simply put a LICENSE text file in the project root, and any relevant details/credits/etc in the README file - it's still copyrighted (automatically), so it's just a question of being clear license-wise in the readme file.

OTHER TIPS

You could, conceivably simply put your copyright notice that mentions a LICENSE file, however there is no guarantee that once released, your code will remain atomic. In fact, it is quite likely that bits and pieces of it will be remixed in at least several other projects.

This is why it is important to at least have the following in every source file:

/* Copyright (C) 1883 Thomas Edison - All Rights Reserved
 * You may use, distribute and modify this code under the
 * terms of the XYZ license, which unfortunately won't be
 * written for another century.
 *
 * You should have received a copy of the XYZ license with
 * this file. If not, please write to: , or visit :
 */

You accomplish two things by doing this:

  • Your copyright is asserted no matter how your code disintegrates and scatters in the future.
  • You make the terms of using, distributing and modifying it quite clear, even if someone happened to receive only a small part of a library that you wrote.

A lot of people also include their e-mail address under the copyright, which is helpful for receiving patches in the future. I received a patch last month for code that I wrote five years ago and had long forgotten about. Of course, that means maintaining an e-mail address and putting up with a bit of SPAM.

If ever you actually need to enforce your license, it is critical that the other party can't say that the terms were ambiguous or missing, all kidding aside.

Plus, it's fun to watch how bits and pieces of your code find their way into other bits and pieces of code over time. Most people play fair and respect copyright and license terms.

Just wanted to note Open Source != No Copyright.

Open Source relies on someone claiming copyright then adopting a specific legal document (Like the GPL) to give others rights to that code.

So whatever you decided is suitable for closed source code is also suitable for open source code.

For any open-source project

You are defining the conditions under which the code is to be used and redistributed (or not, depending on those conditions).

At the very least, a license can answer questions such as:

  • Appropriation: Can someone take the code and evolve it into a different project? A good example of such a phenomenon is Google Chrome, which is based upon the open-source Chromium project.
    • Do they need to give you credit, seek permission, etc...
  • Commercial Use: Can your code be used commercially, such as within Photoshop as a third-party DLL? If so do different conditions apply?
  • Redistribution: Do any uses of your code have to be in software with a similar/identical license? Licenses such as the GPL which require this are called viral licenses (and I don't know if that's a negative term, or just a statement of fact).

Etc. That's by no means a comprehensive list, it's just to give you an idea of the questions a license would state clearly.

Another reason to put a copyright on your code is that it lets others know who wrote it. I like to be able to see where code came from and how long it has been around. It is interesting and useful to see how code has been used in other projects. So even though legally you may not need to put your copyright on something, please add it for informational reasons. --a thornton

Licensed under: CC-BY-SA with attribution
scroll top