Suggestion: naming conventions
erf opened this issue · 6 comments
I see in the examples the use of counterRef
and i wonder if the name counterState
would better describe the state objects as a convention - that is ending with State
instead of Ref
.
Also counterViewLogicRef
could perhaps be named counterViewLogic
as a more compact name.
Both naming conventions would then match nicely with the holy trinity of View
-Logic
-State
What do you think?
Interesting point of view. I used ref instead of state or logic because they're really just references or keys used to get the real state.
These objects don't hold any state (it's the BinderScope job) and I didn't want people to be confused.
Maybe Ref is not a good enough suffix and I'm open to new conventions but I'm afraid that using State as a suffix would make people think that the state is held by a StateRef.
What do you think?
I'm thinking that since StateRef is the API used to access state, as opposed to BinderScope directly, i think it would be fine as a convention to name variables that. (the docs could always explain in more detail how the state is stored).
I think State explains better than Ref, that we are dealing with state here. (all variables are already references to some memory)
Yeah when we look at some methods in the api, it would make more sense if they were called State instead of Ref (watch, select, etc).
Let me think about it.
I would also love to have other points of view.
Maybe also you could simplify counterViewLogicRef
to just counterLogic
? As it uses the Logic
mixin (even though ViewLogic is perhaps more descriptive as part of the MVVM paradigm)
My current naming convention for the Logic associated with a view is LogicRef, so that you can have a logic component for a piece of the UI which can be a view (or page), but also just a widget.
You're free not to follow this convention if you don't think it's relevant for you, but it makes sense for me.
I think i change my mind regarding the names. I think counterRef
or perhaps counterStateRef
and counterLogicRef
makes sense, as you just use them to set or get the state using write / watch / read etc.