Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do vs. Run vs. Execute vs. Perform verbs [closed]

  • What list of verbs are you using for method names? What's your personal or team standard?
  • I debate whether to use Do vs. Run vs. Execute vs. Perform and am wondering if any of these are no longer recommended or some that people just don't really use and I should just scratch them. Basically any one of those verbs mean the same thing...to invoke some process (method call). This is outside of CRUDs. For example:

ExecutePayPalWorkflow();

that could be also any one of these names instead:

DoPayPalWorkflow();
RunPayPalWorkflow();
PerformPayPalWorkflow();

or does it not really matter...because any of those verbs pretty much are understandable as to "what" shows your intent by the other words that follow it "PayPalWorkflow"

Naming is something I take very seriously and really think about a lot while coding as:

  • it makes code readable to other devs
  • it makes my code readable to myself weeks later when I can't remember what I coded

This discussion can go for any language. I just put the two main tags C# and Java here which is good enough for me to get some solid answers or experiences.

like image 262
PositiveGuy Avatar asked May 19 '10 16:05

PositiveGuy


1 Answers

Shouldn't your method names usually be verbs to start with? Like your example, you could just use the verb Pay instead of Perform + Payment.

Edit:

As for how you might use any of the verbs you list (Execute, Do, Run, Perform), I don't think they are necessary at all. They do not convey any additional information. The fact that you are calling (or executing or doing or running or performing) a method is implied by your syntax.

If you'd like to indicate to the caller that your method may return before the action has completed, there is a convention for that in .NET: Begin* and End*.

The only exception I can think of is if you have an abstraction for any general process. In that case, you'll be forced to use a verb such as Execute or Run, since what you're actually doing isn't yet defined.

like image 140
Michael Petito Avatar answered Sep 24 '22 12:09

Michael Petito