Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
biglars2405yWould probably have skipped both and just used UserExists.
If(UserExists)
Reads better tbh. Otherwise does. -
I personally follow those rules:
consistency > case > grammar
So DoesUserExist, only and only if the rest of your code follows the same pattern. -
IsUserCreated; //if it is about creation a user
IsUserAvailable; //If about doing stuff when the use is there
IsUserRecordFound // If it is about databases -
irby2285yIt's based on consistency and constructs of the team. We have a lot of times where we use IsActive, IsAdmin, etc. If we were to introduce a new Boolean to check if a user exists, we would prefer to use IsUserExist to keep the naming consistent.
-
ddephor44465y@irby Adding 'is' to a getter for a boolean is redundant, just drop it. Here it is also confusing as it contradicts the natural language.
If you wanna be sure that it's a boolean, your IDE will show you. -
This is a good example of why it is bullshit to have "is" in the beginning of a bool variable or method or whatever.
I hate this convention/rule/requirement. -
@Lyniven
I'd have had assumed this would be in a service or something. Why would you have a User object if you don't know if the user exists? -
Lyniven44535y@delegate212 The user class not the object here sorry.
With model relation, if you have a comment with an user_id, the Comment.user() method will receive the user_id and do the query, it'll then check if the returned stuff is an *instance of* the given user class.
Dunno if I'm clear x) that's my way of doing stuff -
TheCreatureWhoTakesAdvantageOfThisProductIsAHumanBeingWhoSeemsToBeVisiblyPresentAmongUsInThisPhysicalUniverseWeAllAreSimultaneouslyExperiencingAndParticipatingIn
What's is more appropriate name for a method?
IsUserExists
DoesUserExist
rant