Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

Some data are injected by some external program before the app load in window.map

I have a mapManager module which has a bunch of methods to get some data from window.map ( for example , mapManager.getDestinationById() );

What I've done is that I've writtent models to get the data:

define('getDestinationByIdModel', ['backbone','mapManager'], function(Backbone, MapManager) {
    var GetDestinationByIdModel = Backbone.Model.extend({
        fetch: function(id) {
           this.set({destination: MapManager.getDestinationById(id);
        }
    });

    return GetDestinationByIdModel;

}

The idea was to keep the principle that to access data in a view you have to use a model.

However I'm wonderng if it's not just too heavy, why not just use the mapManager methods inside the views to access data instead of creating a model for each method of the mapManager ? Isn't a mistake to follow the model way or is it the best to do to keep some kind of fixed structure.

Thanks for sharing your thoughts

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.