3 ms·
I've tried both Backbone (and Spine) and both were great for small to medium sized apps. I hadn't heard of Knockout before, but from my experience data binding
by kreek 15y ago
I've tried both Backbone (and Spine) and both were great for small to medium sized apps. I hadn't heard of Knockout before, but from my experience data binding (two or one way) works, again, great for small apps but falls apart when you need to customize it.
My experience in Backbone was that things are a bit too tightly coupled. 'Controllers' (which are called views) are mapped to templates (the actual views). Views have a Model reference directly in the view. Again, for small apps this works great and enables data-binding by tying model changes to view updates (render).
For large apps, in regards to maintainability, I think you really need the C in MVC to stand for Command. Any type of undo/redo needs the command pattern. Commands are great as well as you can throw them away or add them without affecting the rest of your application.
I also wanted a system wide messaging system, or events that can be dispatched and received by any actor in the framework (rather than bound directly between actors).
In the end I rolled my own MVC framework based on traits.js (and borrows from Backbone, Spine, and some Flex frameworks), it's far from complete (no remote persistance yet) but it solved some of the issues I had with current JS MVC frameworks.
https://github.com/kreek/MCjs/blob/master/js/mc.js https://github.com/kreek/MCjs/blob/master/js/mc.js
- derickbailey 15y agoan event aggregator in Backbone: var vent = _.extend({}, Backbone.Events); done. see also http://lostechies.com/derickbailey/2011/07/19/references-routing-and-the-event-aggregator-coordinating-views-in-backbone-js/ http://lostechies.com/derickbailey/2011/07/19/references-rou... for more info on using it, and http://lostechies.com/derickbailey/2011/11/17/introduction-to-composite-javascript-apps/ http://lostechies.com/derickbailey/2011/11/17/introduction-t... for more info on creating larger apps w/ backbone
- kreek 15y agoThanks Derick, I'd actually seen that on your site before and used it with Backbone.