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

Replace hard-coded naming conventions with cat-naming-service #44

Open
tsalzinger opened this issue Oct 2, 2015 · 0 comments
Open

Replace hard-coded naming conventions with cat-naming-service #44

tsalzinger opened this issue Oct 2, 2015 · 0 comments

Comments

@tsalzinger
Copy link
Contributor

At the moment cat-angular has a lot of hard-coded naming conventions throughout it's code. Especially for somebody who hasn't used it before these are quite daunting as they don't follow any particular pattern. (Note: this is not entirely true, and there have been reasons for all of the current conventions at the time, but it should still be cahnged)

A way to get rid of all these strange patterns would be to replace them by function calls to a dedicated service. This would mean that the only thing the user provides would be a single string at the entry point of listAndDetailView which will then be passed to different service methods.

function CatNamingService {
    /* State names */
    this.getListStateName = function(name, parents) {/**/};
    this.getDetailStateName= function(name, parents) {/**/};
    /* Template names */
    this.getDetailViewTemplate= function(name, parents) {/**/};
    /* Endpoint names */
    this.getEndpointName= function(name) {/**/};
    // ...
}

The above code is just a first idea of how it could look like (no real though has gone into it).
The actual implementation should be quite straight forward and probably don't transform the name at all and just use it as is, and concatenate with parent names where applicable.

For the legacy part i would just add a separate module cat-legacy-naming in cat-angular (but not part of the cat module dependencies) which decorates the service to provide the current naming conventions.

A more sophisticated approach could be to provide multiple naming strategies.

Improving on the single cat-naming-service one could even go a step further and split the different parts where the name is used into different services like cat-template-source, cat-state-service etc. which would probably better handle separation of concerns.

Furthermore we should get rid of all our ugly window.cat.util stuff ;)

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

No branches or pull requests

1 participant