Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

There is a method that checks if a name already exists :

bool Foo(string name) {
  return Names.Contains(name)
}

What would be the best name for this method?

share|improve this question
    
I'd consider isNameExist(string name). –  palacsint Feb 27 '13 at 17:02
1  
Sorry, but a single word request is not a Code Review. Feel free to open a question on Code Review Meta if you'd like to make an argument for including this in the scope, but for now it is off topic. –  codesparkle Feb 27 '13 at 19:58
add comment

closed as off topic by almaz, codesparkle Feb 27 '13 at 19:50

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 3 down vote accepted

It depends on what Names is, where it's populated, and so on.

Possibilities include IsExistingName(), NameAlreadyExists(), IsPreviouslyProcessedName(), and so on. Basically, anything which makes sense after the word "if" (after filling in prepositions) is a good function name.

  • "If [it] is [an] existing name..." -> IsExistingName()
  • "If [the] name already exists..." -> NameAlreadyExists()
  • "If [it] is [a] previously processed name..." -> IsPreviouslyProcessedName()
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.