ue5-style-guide icon indicating copy to clipboard operation
ue5-style-guide copied to clipboard

"Bad example" follows established guidelines

Open mika-koivuranta opened this issue 1 year ago • 3 comments

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.

mika-koivuranta avatar Jan 29 '24 13:01 mika-koivuranta

"Target" can be a verb or noun hence the ambiguity. OnTargetting or OnBeginTarget would eliminate the ambiguity.

wobbleyheadedbob avatar Jan 29 '24 13:01 wobbleyheadedbob

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.

Jump is also a noun.

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.

mika-koivuranta avatar Jan 29 '24 14:01 mika-koivuranta

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.

lucastucious avatar Jan 29 '24 14:01 lucastucious