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

Comments on naming variables #111

Open
AlexandreRoba opened this issue Jun 20, 2016 · 0 comments
Open

Comments on naming variables #111

AlexandreRoba opened this issue Jun 20, 2016 · 0 comments

Comments

@AlexandreRoba
Copy link

Thanks for all the good work you guys have put on Mantra. I found it clean and well architected.

I have a comment more general in the naming convention used on this sample. I'm new to Meteor and to Mantra but I found reading the code sometime difficult and I'm told to be someone with some experience in coding.

I'll take for example the container of the NewPost component:

export const composer = ({context, clearErrors}, onData) => {
  const {LocalState} = context();
  ....
  return clearErrors;
};

Why do we call the context that is a function that returns the context "context"? I mean clearErrors is well named. It is a name that contains a verb. It is seen as a function right away...
Why not doing this for context as well and name is getContext? Wouldn't this be easier to read?

Why also not naming the container with container? Is the fact that it will be used in a composition not obvious when it is a container?

When I code I try to have explicit naming even if they are longer... I would find this sample easier to read if a more obvious naming convention would be used and encourage mantrajs usage.

I would personnaly have something like

export const newFormContainer = ({getContext, clearErrors}, onData) => {
  const {LocalState} = getContext();
  ....
  return clearErrors;
};

This does not remove the really good work you guys have put into this but it would make it easier to understand if some more attention was put the naming convention.

Keep doing the good work.

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

1 participant