Simple Getter/Setter comments

前端 未结 14 1021
悲&欢浪女
悲&欢浪女 2020-12-04 07:16

What convention do you use to comment getters and setters? This is something I\'ve wondered for quite some time, for instance:

/**
 * (1a) what do you put h         


        
14条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 07:27

    Don't put anything if the field name is suficiently descriptive of the contents.

    Generally, let the code be self standing, and avoid commenting if at all possible. This may require refactoring.

    EDIT: The above refers to getters and setters only. I believe anything non trivial should be properly javadoc'ed.

提交回复
热议问题