ue5-style-guide
ue5-style-guide copied to clipboard
"Bad example" follows established guidelines
3.3.1.1 All Functions Should Be Verbs
Bad example has "OnTarget". However, "Target" is a verb
OnTarget isn't ambiguous. It fires when "this" has started targeting someone.
"Target" can be a verb or noun hence the ambiguity. OnTargetting or OnBeginTarget would eliminate the ambiguity.
Think of a function named "OnJumping". Does that happen when jump started, or when it ended, or every frame while jumping? Of course, we could write "OnBeginJump", at which point we've landed on shortening it to simply "OnJump", which we can all agree follows the established guidelines.
The two first "good examples" are also nouns:
OnDeath OnPickup
This leads me to believe that "OnTarget" is mistakenly listed as a "bad example", not that the whole category is incorrect.
Jump is an action, Target is not. I agree that it's a bad "bad example" but only the fact that we have this conversation illustrate that function names don't have to be ambiguous.