Naming boolean field that is a verb

Posted by dnhang on Programmers See other posts from Programmers or by dnhang
Published on 2013-10-11T14:53:56Z Indexed on 2014/08/20 22:33 UTC
Read the original article Hit count: 391

Filed under:
|

In Java, by convention getter and setter for boolean fields will be isField() and setField(). This works perfectly fine with field names that are adjectives like active, visible, closed, etc.

But how do I name a field that has meaning of a verb, like haveChildren? Add _ing to the verb (havingChildren), maybe?

Edit: to clarify, I don't have control of the method names (getter and setter), they are auto-generated by the IDE. So what I need is an appropriate field name so that when the IDE generate a getter for it, it make senses. For example, hasChildren is a perfect field name, but when the IDE generate the getter for the field it would be isHasChildren. How do I solve this?

© Programmers or respective owner

Related posts about java

Related posts about naming