Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does source code management make Javadoc's @author and @since redundant?

In most teams there is a rule that says that the @author and @since keywords have to be used for all documented classes, sometimes even methods.

In an attempt to focus on what matters, I don't use these keywords and instead rely on the fact that I can use the source control management system to determine who the author of a class is and since when it exists.

I believe that @author and @since come from a time where version control was not yet common and I think that they are rather redundant by now. How do you think about this? Should modern Java projects use them?

like image 700
Noarth Avatar asked Sep 16 '10 20:09

Noarth


1 Answers

I think the @author tag actually confuses things. First of all, if it isn't updated judiciously, it becomes wrong. Also, what if you (not being the original author) change half a class? Do you update the @author? Do you add one? And what if you change only a few lines in the class?

I also think it promotes code-ownership, which I don't think is a good thing. Anybody should be allowed to change a file. If there's an @author tag, people will tend to let this author make all the changes instead of doing it themselves and maybe learning something in the process.

Finally, as you said, the same information, in much more detail, is available from your VCS. Anything you add in Javadoc is duplication. And duplication is bad, right?

EDIT: Other answers mention the fact that you may not have access to the VCS, and in such cases the @author tag is useful. I humbly disagree. In such cases, you're most likely dealing with a 3rd party library, or perhaps an artifact from a different team inside your company. If that's the case, does it really matter who the individual was who created a certain class? Most likely, you only need to know the entity who created the library, and talk to their contact person.

like image 178
jqno Avatar answered Sep 24 '22 20:09

jqno