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

Establish a consistent naming scheme of global objects #14

Open
asbjornu opened this issue Jul 13, 2018 · 8 comments
Open

Establish a consistent naming scheme of global objects #14

asbjornu opened this issue Jul 13, 2018 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@asbjornu
Copy link
Contributor

The general Design Guide scripts are located in the object px.script. I think the word script here makes no sense. Why not call it PayEx.DesignGuide? We obviously need to establish a global standard around JavaScript namespacing in PayEx, as Checkout v2 is using payex.hostedView for instance.

Creating all of these global, inconsistently named objects is confusing and looks unprofessional. I think it should be down to the Design Guide to establish how these global objects are named and in that case eCom might have made the choice for us in its rollout of payex.hostedView.

I would prefer pascal casing for "classes" as this, but consistency is more important than my personal preference. I therefore suggest the Design Guide groups all of its globals into payex.designGuide.*.

@erikhallaraaker
Copy link
Contributor

I agree that we need a global standard, but Payex.DesignGuide.Alert.init() seems unnecessary long though..

@hmosvoll
Copy link
Contributor

Do we need init, can't alert just be a function?

Something like payex.designGuide.alert()?

@asbjornu
Copy link
Contributor Author

Also, do we need init at all? If Bootstrap can do without init, shouldn't we too?

@asbjornu
Copy link
Contributor Author

asbjornu commented Jul 13, 2018

I registered #16 for making Design Guide do .init() itself so all of these functions hopefully can be deleted. The point about having a consistent naming convention still stands, though.

@erikhallaraaker
Copy link
Contributor

The problem is that some of the components have utility functions, and per the issue, the goal is to keep it consistent.

We don't NEED the init functions, they are there to give users more control over the components should they wish to do so.

@asbjornu
Copy link
Contributor Author

That makes sense, but as per #16, we should make them optional and per this issue we should ensure a consistent, sensible naming convention. I like @hmosvoll's suggestion of just using the name of the component as an initializer/configurator function, though.

@erikhallaraaker
Copy link
Contributor

Yeah, I agree with using the name as the initializer, the problem is when a component name contains utility functions as well.
Also, they are already optional for regular routing, see my comment on #16

@hmosvoll
Copy link
Contributor

hmosvoll commented Jul 13, 2018

payex.designGuide.alert() could return an object with the util functions, so it could be used like this:

payex.designGuide.alert().utilFunction();

// or

var alert = payex.designGuide.alert();
alert.utilFunction();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants