I’m rewriting my App framework for future reuse and I’ve hit an interesting question:
Is it better to thread the app together with models or with views?
For Instance
Threading the app together with views may look something like (ignore any syntax errors pls)
....
//inside of AppView() or something
var somepage = new PageView({model:new PageModel({url:"whatever"}),some more stuff..}), some more..});
// then in PageView's initialize, listen for the model's load to call render()..
or would it be better to do:
....
var somepage = new PageModel({url:"whatever",view:new PageView({}),some more stuff..}), some more..});
// then in PageModel's parse() function call this.view.render()..
Personally I’m inclined to do code it with the View being prevalent but I’ve seen it done both ways and wondered if there were any major advantages in favour of either.
Incidentally the use case is basically a framework with uses a sort of ‘sitemap’ in JSON to setup a whole site (similar to AS3 Gaia framework does with XML) then it boots up something like this:

Models have 2 typical use cases
In both cases, the models should be part of the view or attached to the view and not vice versa. So clearly option 1.