Conjugation being very rudimentary in English, I would say it doesn't make much of a difference. It might as well be the imperative, particularly if the method is a command in the context of command-query separation. Personally, that is how I read it, because in Slovak, my native language, buttons are commonly labeled with the imperative (which is morphologically clearly distinct from the infinitive in that language).
// Find the first entry (implicit "onward, contraption, find me the first entry!")
function findFirst(array)
{
return array[0];
}
However, if the method name is well chosen, you don't need to rephrase it as a sentence. Instead you document side effects, usage and what not, in which case the imperative is inadequate and one would use the 3rd person indicative. People will of course have dozens of different opinions of this and some will start religious wars over it. Ideally you can let someone else review the code and if they understand what a method does based on its name + documentation, then you have done it right, otherwise not. Further distinctions border on bikeshedding.
Just an example of a method not quite well named:
function greeting()
{
return "Hello";
}
The name in itself leaves multiple options open. Does this actually perform the greeting? Or does it give me a value suitable to greet others?
If performed the greeting itself, then I would call it greet
(or performGreeting
if no suitable verb is available or the verb is ambiguous) and otherwise makeGreeting
(or produceGreeting
or provideGreeting
or somesuch).
printPreamble
orprintsPreamble
? Probably it readsprintPreamble
. And so should your comment.