Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

[Question] naming action #63

Closed
tadeuszwojcik opened this issue Sep 18, 2014 · 4 comments
Closed

[Question] naming action #63

tadeuszwojcik opened this issue Sep 18, 2014 · 4 comments

Comments

@tadeuszwojcik
Copy link

I'd like to discuss best practices about naming actions. Currently I use actions named after what user has done, for example 'FILE_CLICKED', 'ZOOMED', 'VIEW_MODE_BUTTON_CLICKED' etc, is that good convention to name action like that? Only issue I see so far is that I have many *._CLICKED actions. Some people also tend to name actions more like commands, for example 'LOAD_DOCUMENT', 'CHANGE_VIEW_MODE' etc. I'd love your thoughts on that.

@sterpe
Copy link

sterpe commented Sep 19, 2014

Not a maintainer but I started doing :

src/constants/X/Y.json

Which might look like:

{
"FOO": "FOO@X/Y"
}

Sent from my iPhone

On Sep 18, 2014, at 2:53 PM, Tadeusz Wójcik notifications@github.com wrote:

I'd like to discuss best practices about naming actions. Currently I use actions named after what user has done, for example 'FILE_CLICKED', 'ZOOMED', 'VIEW_MODE_BUTTON_CLICKED' etc, is that good convention to name action like that? Only issue I see so far is that I have many *._CLICKED actions. Some people also tend to name actions more like commands, for example 'LOAD_DOCUMENT', 'CHANGE_VIEW_MODE' etc. I'd love your thoughts on that.


Reply to this email directly or view it on GitHub.

@briandipalma
Copy link

I would try and not use the event trigger in an action name, for example 'CLICKED'. You could envision using the same code on a mobile app so it would in fact be triggered by a touch event and not a click.

Minor point though. I'd tend toward an imperative, command approach, i.e. PERFORM_THIS_ACTION and not include what triggered the action or how it should be done.

@fisherwebdev
Copy link
Contributor

I've grown to prefer the reverse syntax of NOUN_VERB, like TODO_SELECT. This way, in an alphabetized list, all my TODO actions are together, and I generally want to sort on nouns, not verbs. But really this is just a personal preference, and any naming scheme you and your team have good reasons to adopt is perfectly appropriate.

@tadeuszwojcik
Copy link
Author

Great, thanks guys for the feedback! It's all what I wanted to know.

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

No branches or pull requests

4 participants