mantra-sample-blog-app icon indicating copy to clipboard operation
mantra-sample-blog-app copied to clipboard

Comments on naming variables

Open AlexandreRoba opened this issue 8 years ago • 0 comments

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.

AlexandreRoba avatar Jun 20 '16 13:06 AlexandreRoba