Boolean method naming readability

后端 未结 12 752
南笙
南笙 2020-12-12 15:10

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

public boolean isUserExist(...)

or:

12条回答
  •  醉话见心
    2020-12-12 16:05

    The goal for readability should always be to write code the closest possible to natural language. So in this case, userExists seems the best choice. Using the prefix "is" may nonetheless be right in another situations, for example isProcessingComplete.

提交回复
热议问题