mercredi 11 février 2015

Backbone Design - Large application, data as needed

I have a Backbone design pattern question.


Say I have a very large app, I am talking around 30 models, a lot more views and components.


My design problem is this:


I can not bootstrap the data. This app is 100% API driven, I can also not fetch all of the entities in one go (talking thousands of instances per database table). And I can not cleanly do a separation of applications into smaller modules, as each heavily rely on all of the models, and collections.


At the moment I have got controllers which I have a dispatcher teardown and setup each controller as needed. The controllers job is to create the models, and fetch all of the required data to fulfil that screen. Then the views render.


This method is starting to prove problem some, and am looking for some advice regarding applications of this size.


The other solution I had though of would be to scrap the Controller doing the fetching and moving such logic to the Views. However, each view has a lot of children views which also require this data. Would it be better to have those sub-views spawn ASAP then get them to fetch their own required data (and implement a caching mechanism), or to have the parent spawn the sub-views once it gets the data returned (I understand each have their use cases).


Aucun commentaire:

Enregistrer un commentaire