java中到底该不该用@author标识作者?

今天查看activiti的README,突然发现一段很有意思的FAQ。

Why do you not accept @author lines in your source code?

    Because the author tags in the java files are a maintenance nightmare
        A large percentage is wrong, incomplete or inaccurate.
        Most of the time, it only contains the original author. Many files are completely refactored/expanded by other authors.
        Git is accurate, that is the canonical source to find the correct author.

    Because the author tags promote code ownership, which is bad in the long run.
        If people work on a piece they perceive as being owned by someone else, they tend to:
            only fix what they are assigned to fix, instead of everything that's broken
            discard responsibility if that code doesn't work properly
            be scared of stepping on the feet of the owner.

    Credit to the authors is given:
        with Open Hub which also has statistics
        in the GitHub web interface.

问题:为什么不在源码中使用 @author ?

首先,@author 是什么?

Java 文档注释标签。
其他常用的有:

@author 作者
@param 输入参数的名称 说明
@return 输出参数说明
@since JDK版本
@version 版本号
@see 链接目标
@throws 异常
@deprecated

为什么不用?

activiti作者认为:

  • 不利于java文件的后期维护。
  • 对于长久来说,为代码标明所有者是很糟糕的事情。
  • 代码版本工具提供了作者的提交历史记录,不需要再单独标识。

我觉得说的很有道理!

但是,公司内部的管理来说,有些人就是喜欢打上程序员的标签。
好吧,全世界的问题都是程序员的错!

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值