What information do you consider worth to put in the comment at the beginning of a sourcecode file?
All I could think about was the name of the author and perhaps the date the file was created (although I'm not to sure if there is any useful value to this information).
[EDIT] To clarify, I don't mean comments before a class, but at the first lines of the file, before include statements and what else. Like
/**
* Author: Name
* Created: 11.05.2009
*
* (c) Copyright by Blub Corp.
**/
The single line comment is //. Everything from the // to the end of the line is a comment. To mark an entire region as a comment, use /* to start the comment and */ to end the comment. * This is a block comment.
Your comments should rarely be longer than the code they support. If you're spending too much time explaining what you did, then you need to go back and refactor to make your code more clear and concise.
Edit: Changed Author(s) to Original Author(s)
Anything that duplicates low level logic which is part of the code itself. This can lead to maintenance problems if it isn't updated when the source code changes.
Author name(s). Why?
Creation and last changed dates. This is for similar reasons as list above. Revision control includes this information - why duplicate it in the header, making more work for yourself and risking leaving inaccurate information in the comment when things inevitably change?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With