Sproutcore vs jQuery +backbone.js
21–30 of 48 posts
Re: Sproutcore vs jQuery +backbone.js
#22To throw my hat in the ring (full disclosure, I work on Backbone.js): Unless you're a really fastidious coder, some sort of library to help structure large-scale JavaScript applications is important -- it's far too easy to degenerate into nested piles of jQuery callbacks, all tied to concrete DOM elements. To that end, choosing any of these options can be a positive step, and I have massive respect for Charles and th…
The "best" thing about backbone is that it forces you to smartly separate your code logic. However, I don't agree with everyone about how lightweight it is. I find myself more and more simply writing the logic/view in different files without using backbone at all. (I do use a lot of underscore thought).
The problem is that, for really simple models/view, backbone is way too verbose. And for complicated use, you need to hack backbone hard to make it do what you want. So, in my opinion (and experience with backbone), it really shines for medium use.
I wish there was a little library built on top of backbone that make it easier for small/complicated use.
I'll give you an example of what I mean: If you have a models that contains other models. At first, I thought that would be builtin, but it is not. So, if you want to do that the backbone way, you really need to hack it so change in inner models propagate to outside models. This behaviour is the kind of thing that a little library could do "for free" on top of backbone.
On a last note, I need to say that I don't like that much the backbone documentation. Don't get me wrong, each function is well explained and after reading all of it you get a good grasp of what backbone can do for you. The problem is that you need to read all of it. I much prefere a small tutorial to get you started and help you understand the philosophy of backbone with a high level of models, collections and controllers. And only then, after I started using it, I would read in depth the function I need.
It's a little bit like if you wanted to learn python by reading all function in the standard. It takes a lot of time and you might not totally get what python is. It's better to follow a simple tutorial which explain the big lines of python, and then, dig deeper in the function you really want.
So, I'm not saying backbone is bad.. in fact, it's probably the best library out there for simple MVC use. I have huge respect for jashkenas and the job is has done.
Re: Sproutcore vs jQuery +backbone.js
#23Earlier quoted context omitted.
I've done some interesting applications with Backbone.js over the last 2 months or so (for anyone that uses uTorrent, here's one: http://apps.bittorrent.com/ucast/ucast.btapp all in about 800 lines of code, just unzip the btapp file if you'd like to see the source). After trying other things like SproutCore, Cappuccino or Evently, I'll never go back. I actually ended up being surprised by how backbone changed what I…
Could you share how you implemented unit testing your backbone controllers' javascript code?
Everything ends up being in a small testable chunk that you can stub out the interfaces for and test (see sinon.js, can't say enough good stuff about that). I've also got a small Backbone.sync implementation that just loads test fixtures and returns data from that, allowing me to have a db to test against that's fake and synchronous. With couchdb, all I have to do is take a DB dump of what I want to test, put it into a file in my test directory and I've got instant fixtures.
Re: Sproutcore vs jQuery +backbone.js
#24To throw my hat in the ring (full disclosure, I work on Backbone.js): Unless you're a really fastidious coder, some sort of library to help structure large-scale JavaScript applications is important -- it's far too easy to degenerate into nested piles of jQuery callbacks, all tied to concrete DOM elements. To that end, choosing any of these options can be a positive step, and I have massive respect for Charles and th…
I've been using backbone exclusively for my project and I'm not sure anymore if I made the right choice. The "best" thing about backbone is that it forces you to smartly separate your code logic. However, I don't agree with everyone about how lightweight it is. I find myself more and more simply writing the logic/view in different files without using backbone at all. (I do use a lot of underscore thought). The proble…
Can you expound on this requirement, perhaps give an example? I'm very interested in what you want to accomplish.
Re: Sproutcore vs jQuery +backbone.js
#25The main issue I have with sproutcore is that you build the UI in javascript, completely ignoring markup, which feels like a huge regression in layout managment. While this does have performance advantages and Yehuda Katz has promised that they are working on a way for developers to manipulate markup directly thats not how its built to be used currently.
Re: Sproutcore vs jQuery +backbone.js
#26To throw my hat in the ring (full disclosure, I work on Backbone.js): Unless you're a really fastidious coder, some sort of library to help structure large-scale JavaScript applications is important -- it's far too easy to degenerate into nested piles of jQuery callbacks, all tied to concrete DOM elements. To that end, choosing any of these options can be a positive step, and I have massive respect for Charles and th…
I would really like to see a comparison between backbone.js and knockout.js I just switched a page over to backbone- it is a lot more sane now- thanks! The page had a table view (dataTables as mentioned in the article), but I didn't want to learn the dataTables API, I just wanted to access my data. I added the tableSorter plugin and uiTableFilter search plugin and I had all the dataTables featues I needed. People are…
I would beg to differ. The power of backbone.js comes from being agnostic towards widget implementations. People are adapting it to work with all sorts of widgets. There are scores of widgets in jquery ecosystem. Why limit the backbone MVC goodness to only a few widgets ?
Re: Sproutcore vs jQuery +backbone.js
#27Earlier quoted context omitted.
I've been using backbone exclusively for my project and I'm not sure anymore if I made the right choice. The "best" thing about backbone is that it forces you to smartly separate your code logic. However, I don't agree with everyone about how lightweight it is. I find myself more and more simply writing the logic/view in different files without using backbone at all. (I do use a lot of underscore thought). The proble…
If you have a models that contains other models. At first, I thought that would be builtin, but it is not. So, if you want to do that the backbone way, you really need to hack it so change in inner models propagate to outside models. Can you expound on this requirement, perhaps give an example? I'm very interested in what you want to accomplish.
{ id: 3, text: 'test', comments: [{ cid:4, bleh:5}, {c id:6, bleh:4}] }
You give that to a model. It won't automatically create a collection with comments.The idea behind backbone is that I could insert a new comment in the page by simply .add() something to the comments collection. Automatically, that would trigger a add/change event so that my view could update itself. However, it was really quite complicated to obtain that behavior.
I know it's a simple example but the more I used backbone, the more "simple" things like that happened where I had to dig into things I shouldn't have to.
I feel that simple cases should be simple while I would understand that complicated case might be more complicated. However, with backbone.js, I really feel that simple cases aren't that simple.
Re: Sproutcore vs jQuery +backbone.js
#28The main issue I have with sproutcore is that you build the UI in javascript, completely ignoring markup, which feels like a huge regression in layout managment. While this does have performance advantages and Yehuda Katz has promised that they are working on a way for developers to manipulate markup directly thats not how its built to be used currently.
Could you expand on why you feel like building a UI in JS is a regression? Is this a popular sentiment? I really prefer working on layouts without manipulating markup, so I'm curious to why others feel different. Thanks!
Hope that answers your question.
Re: Sproutcore vs jQuery +backbone.js
#29Earlier quoted context omitted.
If you have a models that contains other models. At first, I thought that would be builtin, but it is not. So, if you want to do that the backbone way, you really need to hack it so change in inner models propagate to outside models. Can you expound on this requirement, perhaps give an example? I'm very interested in what you want to accomplish.
A post that contains comments. Say you have: { id: 3, text: 'test', comments: [{ cid:4, bleh:5}, {c id:6, bleh:4}] } You give that to a model. It won't automatically create a collection with comments. The idea behind backbone is that I could insert a new comment in the page by simply .add() something to the comments collection. Automatically, that would trigger a add/change event so that my view could update itself.…
window.Post = Backbone.Model.extend({...});
window.Comments = Backbone.Collection.extend({...});
var p = new Post(
id: 3,
text: 'test',
comments: [
{ cid:4, bleh:5},
{c id:6, bleh:4}
]
});
You want some way to declare that comments are Comments, so that it is always the case that: (p.attributes.comments instanceof Comments) === true
And you also want: p.attributes.comments.add({...});
To trigger a 'change:comments' event on p, even though you aren't changing the reference to the comments collection, just changing its comments.Do I understand you correctly?
Re: Sproutcore vs jQuery +backbone.js
#30The main issue I have with sproutcore is that you build the UI in javascript, completely ignoring markup, which feels like a huge regression in layout managment. While this does have performance advantages and Yehuda Katz has promised that they are working on a way for developers to manipulate markup directly thats not how its built to be used currently.