Boolean method naming readability

后端 未结 12 747
南笙
南笙 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 15:52

    Purely subjective.

    I prefer userExists(...) because then statements like this read better:

    if ( userExists( ... ) )
    

    or

    while ( userExists( ... ) )
    

提交回复
热议问题