views:

296

answers:

11

It is necessary to put copyright information and some other stuff on top of every source file in large enterprise projects. What is your preferred template, what should be included/excluded?

I am more or less thinking of this:

/**
 * This file is part of blabla.
 * Created: 
 * Changes:
 * 
 *
 *
 * $Id$
 * Copyright (C) YEARS BlaB Company.
 */
+4  A: 

Don't put anything that can get out of date, 'cause no one will remember to update it.

J Francis
If you use version control, a VCS can often update that header, such as last updated by (and when), all of the editors, etc.
Thomas Owens
Why pollute the source file with this information if it's available in the VCS already?
J Francis
+1  A: 

For .NET, StyleCop wants there to be a copyright header using their Microsoft's notation.

The most basic is:

// <copyright file="theFileName.ext" Company="YourCompany">
//     Copyright (c) YourCompany blah blah blah.
// </copyright>
chills42
A: 

If it's a large enterprise project, it's almost certainly being done by an organization that has these requirements already in place.

I work for a large company and they change the copyright requirements just about every year which annoys the hell out of us.

The one thing that stays common is the requirement to use the full word "Copyright" unless you have the real (c) symbol [NOT the three characters: (, c, )], the use of the year of first and last publication and the rights reservation clause. For example,

Copyright 1995, 2008 HAL Corporation.
All rights reserved.

I don't know if these are required by law. I do know that HAL Legal will descend on me like a pack of dogs if I don't follow their rules. They are a company that would know. They also lodge their source (well, enough of it to be handy in a court case) with the Library of Congress.

But, you should not be asking for legal advice on SO (or anywhere other than at a lawyers). Think of the lawyers' children, how will they eat?

With regards to the non-legal stuff, I follow the same rule for function headers. Describe what the item is (the file in this case), not how it works (which is better left to the real code).

And nobody cares when they're reading the file who wrote it or its history - that stuff can be obtained from source control if it's needed. I'd leave out the $-tags.

paxdiablo
You are not required to put a Copyright Notice or All rights reserved message in your source code since the Berne Convention, which has been signed by nearly every country in the world, including yourshttp://www.iusmentis.com/copyright/notice/http://www.iusmentis.com/copyright/allrightsreserved/
Jasper Bekkers
"...in certain jurisdictions, most notably the USA, including a valid notice means that an infringer is deemed to have known of the copyright status of the work. As a result the court will hold him accountable for willful infringement, which carries a much higher penalty than innocent infringement."
paxdiablo
+3  A: 

I think that copyright should be enough. Everything else will be available by a query to the version control system.

divideandconquer.se
+2  A: 
  1. Separate any license/copyright information into a 'normal' comment, not a JavaDoc comment (ie, make the initial /** a /*, place it at the top of the file.
  2. Put your JavaDoc describing the class/interface directly above the class declaration.

Opinion:

I don't include RCS keywords in source (like $Id$) - I've found that information to be less than useful, hindering diff operations.

Ken Gentle
A: 

Abandon all hope ye who enter here

PaperPlate
Why this completely useless comment?
Gamecat
if it was slashdot I might give it +5 (funny)
John Ferguson
A: 

This is similar to What to write in the header comments of a code file. Not identical though, so I'm leaving it open.

Greg
A: 

As I understand it, what you're asking about is not a technical question but a legal question. As such, if you work for a large firm, chances are they've got a legal department. I would consult the legal staff and ask them what they want to see in the headers (if anything). There are probably, as others have pointed out, copyright issues that condition certain notices being present in the source. I'm not a lawyer and I doubt that anyone else is here either. The advice of anyone without legal training, in this particular case, is highly questionable. It's kind of like relying on WebMD to diagnose the fainting spells you're experiencing.

Onorio Catenacci
+1  A: 

If you really must have something (and I would argue strongly that it is completely pointless, probably legally meaningless and quite ugly), then make sure that it can be entered and maintained automatically by some tool. For example a commit hook in your version control system.

This is definitly not the sort of thing that you want to force your developers to maintain.

serg10
+2  A: 

As little as you can get away with. If the lawyers say you have to have copyright info, then so be it. Who created it, modified it, etc should be in source control.

Paul Croarkin
A: 

Basic copyright

Modification history ( condensed ) with authors/dates

Version info

gnlogic