5

Not having english as my primary language, I often question grammar when naming methodes and properties.

I use NextCommand as name for my command, NextCommandExecuted for the execution method and CanNextCommand for the status.

Does this make sense, or is there a more correct naming convention I should use?

Jehof
  • 34,674
  • 10
  • 123
  • 155
rozon
  • 2,518
  • 4
  • 23
  • 37

4 Answers4

5

In your suggested names NextCommandExecuted sounds/seems like the command has been executed or it has completed its execution which sounds a bit incorrect to me.

I would prefer

NextCommand

NextCommandExecute

and

CanNextCommandExecute

Haris Hasan
  • 29,856
  • 10
  • 92
  • 122
4

The question is what does the NextCommand?

If it moves to a next element in a list, then i would prefer MoveToNextCommand as name for the command. CanMoveToNext for the method to check if the command can be executed and MoveToNext for the method that executes the command.

Jehof
  • 34,674
  • 10
  • 123
  • 155
0

I use NextCommand, NextCommandExecuted and NextCommandCanExecute

Emond
  • 50,210
  • 11
  • 84
  • 115
-1

I usually do like follows:

NextCommand

OnNextCommand

OnCanNextCommand
Valentin V
  • 24,971
  • 33
  • 103
  • 152
  • 3
    Shouldn't the On... convention be used for event-raisers? See: http://stackoverflow.com/questions/724085/events-naming-convention-and-style – Emond May 26 '11 at 07:02
  • 1
    I use On__ for both event raisers and commands. Just like 'On' for brevity. – Valentin V May 26 '11 at 07:04
  • 3
    These On...'s are not commands but they are handlers. Which can cause confusion (apparently) – Emond May 26 '11 at 07:12