-
Notifications
You must be signed in to change notification settings - Fork 51
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
maria.subclass without namespace #68
Comments
For example, I could do this:
But creating the namespace object seems like a step that could be avoided somehow. Maybe by making the Another option would be defining the entire application in a single file, but I want to avoid doing that. Any ideas? Thanks in advance. |
I suppose I could assign only the classes that |
A bit of philosophy about the various It is the sugar layer, and only the sugar layer, that uses the namespace object to which you refer. The namespace object is critical in how the sugar layer works. The namespace object is how the "convention over configuration" binds all the classes together. For example, I understand that you find creating the namespace object in your example is unappealing. I agree. That is boilerplate that no one would want to type for every class definition. (AMD style does introduce boilerplate.) I understand you do not want to write your entire application in a single file. Fifty-thousand line files are not friendly. Maria needs to be either told which controller constructor is used for a particular view, for example, or needs to know where to find it. The sugar allows both options. The less you type, the more it will find for you. Your example code doesn't quite show what, I expected. You've included a model but I expected to see a template. Here is a possibility where there is no dependence on convention. Everything is configured.
This could be shortened if subclass returns the created constructor function (which it does not currently do but I've considered)
For use with AMD, I'm not sure how we could make the Maria sugar layer require less configuration and use more convention as AMD is actually intentionally designed to have the developer be explicit about everything. |
Thanks, that information helps a lot. (My example erroneously had a model instead of a template in the define function.) I think I will continue to use the Ex:
Thanks again for the advice. |
That looks like a good solution to get moving immediately. If you are not using any of the name-based conventions, then I think you could do the following.
I am considering (partly thanks to this issue) making this part of Maria so you can optionally write
This is how I originally had Maria designed but when I wanted to use name-based conventions it broke down and so I switched to the three arguments of the |
I'm attempting to switch my application to an AMD style. Currently,
maria.subclass
and friends receive a namespace argument that is expected to contain all of the relevant classes for the application. However, using AMD, all of my classes will be provided via arguments in mydefine
function.Is there an alternative to creating my own namespace object and assigning all of the classes into it so that it can be passed into
maria.subclass
short of recreating all of the functionality thatmaria.subclass
(andmaria.ElementView.subclass
, etc) provides?The text was updated successfully, but these errors were encountered: