Is it a good practice to start a method name with "Does" (in C#)? It looks a little bit weird to me, so I would like to get your opinion.
I am writing a method which check if an account exists or not, should the signature be "bool DoesAccountExist(id)"? Is there a better name?
Thanks!
For methods or properties that return a boolean, it can be useful to use a naming convention where the method begins with the word "is". If you use "is," you'll have to rephrase the rest of the method name so that it makes sense to the reader.
The name should clearly, without ambiguity indicate what the function does. You don't have to jump around searching for the truth. Function names should apply the lower camel case form: addItem() , saveToStore() or getItemById() . Every function is an action, so the name should contain at least one verb.
Java method names By convention, method names begin with a lowercase letter. The method names are verbs or verbs followed by adjectives or nouns. Each subsequent word starts with an uppercase character.
Personally I'd go with AccountExists(id) in this case, since it will look more natural in an if block
if (AccountExists(id)) { }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With