Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Bad example" follows established guidelines #102

Open
mika-koivuranta opened this issue Jan 29, 2024 · 3 comments
Open

"Bad example" follows established guidelines #102

mika-koivuranta opened this issue Jan 29, 2024 · 3 comments

Comments

@mika-koivuranta
Copy link

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.

@wobbleyheadedbob
Copy link

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

@mika-koivuranta
Copy link
Author

mika-koivuranta commented Jan 29, 2024

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.

@lucastucious
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants