Boolean method naming readability

Yuval Adam picture Yuval Adam · Oct 14, 2009 · Viewed 56k times · Source

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(...)

Answer

Martin picture Martin · Oct 14, 2009
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