Hacker News new | ask | show | jobs
by mattyfo 4830 days ago
Catshirt, I actually would love to get feedback on this comment:

>> initialize models and controllers, then pass that data to newly initialized views. at any scale, this hardly differs.

Where do you find it makes the most sense to initialize models & controllers? I've done it in the router function but that feels really heavy and gets big.

Alternatively, since I use require.js I have used a view wrapper that initializes everything and then puts together the sub-views and models/collections as necessary. I like this approach because it feels more organized having it delegated out to my various view files.

Thanks in advance :)

1 comments

router functions i think are sufficient. if size is a problem, multiple routers could help. different routers could also generalize instantiation for certain types of pages. if it gets more specific than that, i put it into the page view logic like you suggested. does this sound reasonable?

aside, but to my original point, you could use any router and you'd still have this problem. these type questions are probably best not answered by Backbone.

edit: no need to downvote. i am open to suggestions or criticism.