Closed juliomenendez closed 11 years ago
I don't like this app structure because a model or collection can be used on an other module. I prefer the actual app structure.
I have to agree with @Freddy03h , models and collections could be used across modules. I rarely find I need this structure.
I do have plans to add a Marionette modules generator. One pattern I have been using looks something like this: https://gist.github.com/mrichard/6169924
A controller (singleton) has a region and module associated with it. The module can be started and stopped as per Marionette modules functionality. They control a region which they can add views as they see fit.
Thoughts?
I think this is too much specialized and I don't use Marionette Controller this way. I know Marionette Controller are a multi-purpose object but I only use for decouple the route definition to the function. In the actual generator I don't use the Communicator object. It's redundant with the Application object because it already have the Wreq's functions.
Marionette Module are really usefull if you don't use RequireJS / AMD modules AMD Modules vs Marionette's Modules. In a context of an AMD application, I see more Marionette Module like a sub-application to use if you have really differents and identified parts in your app and changing the Marionette Layout isn't enough.
Convincing enough to me. Closing this then.
I agree Marionette modules should be a sort of mini stand alone app in the full page app. I would think gmail chat within gmail would be a good example of that.
One thing I didn't really like about Marionette is the communication functionality is attached to the app object and so are the modules. That was some of the reasoning around this modules template. But yeah it could be too specific :).
Also regarding the communicator, with AMD, communicating via the app can cause circular dependencies and the recommended fix is have a standalone communication object.
https://github.com/marionettejs/backbone.marionette/wiki/Using-marionette-with-requirejs
If you run into AMD issues, you many want to consider using it!
So I can have this app structure: