naming-conventionsreadability

Boolean method naming readability


Simple question, from a readability standpoint, which method name do you prefer for a boolean method:

public boolean isUserExist(...)

or:

public boolean doesUserExist(...)

or:

public boolean userExists(...)

Solution

  • public boolean userExists(...)
    

    Would be my prefered. As it makes your conditional checks far more like natural english:

    if userExists ...
    

    But I guess there is no hard and fast rule - just be consistent