What is the name of book that offers guidance on when to use each verb for a method call? For example, I might use GetApples() to return a list of Apple instances; or I might use BindApples(IControl control) if I want to bind these apples to a dropdown list. What book would suggest when you use Get or Bind as part of a method name?
closed as not constructive by Mark Trapp Feb 4 '12 at 11:25
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.
Sounds like "Code Complete", though I haven't read it. Many books will give similar advice.
The basic idea is meant to be simple and intuitive - don't expect a huge dictionary of "use x for y". The general rule is simply that you use "Get" when getting something, "Bind" when binding something, and "XXX" when XXXing something. The principle is that when naming a method, you use the verb that most clearly describes the behaviour of that method. An exhaustive table of verbs and when to use them would be a waste of a lot of paper.
|show 1 more comment|
I don't believe books on this subject are currently in print, mostly because these problems haven't received much attention yet. The concept of always using the same word for a single concept is called a controlled vocabulary.
There is active research though, for example by Einar W. Høst. He wrote a couple of papers on the subject including The Java Programmer's Phrase Book and The Programmer's Lexicon, Volume I: The Verbs. They don't contain exhaustive lists, but mostly theory about the relationships between names and their semantics (which are the foundations for such a list).
As opposed to some, I do think it makes sense to make such a list. Not just to prevent errors, but to make APIs look more uniform and increase their usability (once you know the words, you always guess right about a method's name you know should exist).
As an additional rant, it's a little weird that lots of organisations use code conventions but not actual naming conventions. It's as if the policy is: "We don't care if you name your method abcxyz123, as long as you make sure it's AbcXyz123!"