4 ms·
Out of curiosity, what did Mr. Katz say about setting a reference from the model to the view at the meetup?
by jashkenas 15y ago
Out of curiosity, what did Mr. Katz say about setting a reference from the model to the view at the meetup?
- oscilloscope 15y agoHe had led in to a section on "Other MVC Frameworks". Then a single slide with some code along these lines: Todo = OtherMVC.Model.extend({ clear: function() { this.view.remove(); } }); TodoView = OtherMVC.View.extend({ initialize: function() { this.model.view = this; } }); Basically he ragged on that for breaking MVC, and never mentioned Backbone by name. I spoke to him afterwards, and he seemed pretty set against Backbone. He considers manually bubbling events to be tedious: "not the happy path". I've been inspired by Morphic recently, where models having knowledge of their views makes sense. When I was a beginner though, I was briefly puzzled by how to connect multiple views to a model and vice versa: I first tried to extend the pattern above before binding to model events.