4 ms·
I use jQuery a lot but Backbone is like Greek to me and so is every tutorial I've seen. I just don't get it and I fail to see the benefits. Can someone point m
by Kiro 14y ago
I use jQuery a lot but Backbone is like Greek to me and so is every tutorial I've seen. I just don't get it and I fail to see the benefits.
Can someone point me toward a good and simple explanation/tutorial?
- CWIZO 14y agoI feel exactly the same. I tried to make something simple with bacbone the other day but I just couldn't wrap my had around it. Maybe I'm just stupid, but I too would like to know if there is some article that would explain things more clearly.
- modarts 14y agoTry the Peepcode videos: https://peepcode.com/products/backbone-js https://peepcode.com/products/backbone-js
- uptown 14y agoI'm going through the same thing. I just got a small application up and running using Backbone.js yesterday, but it still feels like a more-complex application could get messy. I did have one question regarding redundancy - if I take advantage of something like validation with Backbone, I still need to do the same validation on the server-side for any data that I POST or PUT back to the server since I can't trust what comes from the client. Is the only gain from doing the client-side validation in Backbone the faster feedback to the user without requiring a round-trip to the server? I'm currently trying to decide between Backbone.js, Angular.js, Ember.js or sticking closer to what I know with a jquery pjax solution.
- mcgwiz 14y agoThe primary gain is faster feedback, but this can also reduce server load. In general, you should never trust user input, so you should validate on the server. (In particular, not only is it possible for users to manipulate/disable your client code, including validation logic, but it's trivial to hand-craft requests to your server.)
- mcgwiz 14y agoSimplest explanation: Backbone is an object-oriented library that can increase maintainability for so-called single-page applications. E.g. it's often used in an architecture which pairs a dynamic web service with static HTML templates, CSS, and JS (no dynamic server-side HTML generation). In this way it is similar to ExtJS/YUI, but generalizes those widget-centric frameworks. It's not for tightly-scoped JS enhancements. In terms of patterns, it adheres mainly to the Model-View-Presenter pattern (embodied in the Model class, the HTML template, and the View class respectively). Switching between logical pages in the single-page app is supported by the Router class (which implement the front controller pattern). Data persistence/retrieval is oriented toward RESTful web services (this is customizable) and therefore pairs will with ActiveRecord-based server frameworks like Rails. The separation of concerns it encourages increases testability, and also allows it to pair well with asynchronous module loaders (e.g. RequireJS).