Live data from Hacker News

Sproutcore vs jQuery +backbone.js

ryth.posterous.com

31–40 of 48 posts

Re: Sproutcore vs jQuery +backbone.js

#31

Earlier quoted context omitted.

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 think backbone.js would have a much greater draw if there were re-usable widgets (views/apps/collections). 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 ?

From speaking with jashkenas on IRC, I found out that while it's not immediately obvious, backbone is quite extendable/pluggable by using Backbone.model.extend.

I reckon that as Backbone matures and gets closer to 1.0 status, we'll start seeing more people start creating plugins. I'm still just an intermediate javascript developer, but once I get a better handle on backbone.js and javascript, I'm planning on writing an undo/redo plugin based on Backbone.model.extend and the included .previousAttributes() function (unless someone beats me too it, of course).

Backbone is quite a bit more abstracted and that is where it gets its power from, but it is also why probably a bit harder to grok when it comes to extending it. I reckon with time and tutorials, we'll see a robust ecosystem develop extending Backbone.js.

Re: Sproutcore vs jQuery +backbone.js

#32
post #9
post #2

The question is are you trying to build a desktop class application or not. If not jquery/backbone is the obvious solution. If a tablview is particularly interesting to you Cappuccino ( http://cappuccino.org ) has simply the best tableview out there. This is what it was like several months ago, and it has only gotten better. http://timetableapp.com/TestingEnviro/imdbdemo/ It's fully customizable too, supporting any k…

In terms of tableview, I find slickgrid a powertool. https://github.com/mleibman/SlickGrid

This best thing about cappuccino's tableview is that it can be use everywhere... For example reimplementing tweetie's tweet list (more on that in a week or so). It doesn't traditionally look like a table, but it is.

It's incredibly flexibly and is used ALL OVER apps in Cocoa. Cappuccino has an amazing tableview, I don't think that can be said for other desktop class browser app frameworks.

Re: Sproutcore vs jQuery +backbone.js

#33

Earlier quoted context omitted.

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!

HTML was designed with presentation semantics in mind (eg layout) and using Javascript to do the job HTML was designed seems like a waste. Hope that answers your question.

I completely agree with this sentiment, however I think that templating systems such as JResign's microtemplates or Mustache.js go a long way to helping us avoid the problems associated with using JS to construct views.

All my views are saved as HTML templates with ERB-like syntax for populating the views with dynamic data received via JSON.

Re: Sproutcore vs jQuery +backbone.js

#34

To 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…

SproutCore Todos: 2.675 MB Uncompressed, onLoad in 1470 milliseconds (loading from localhost).

This is not an exactly fair comparison, a lot changes between the developer mode and actual build for deploy mode. Both in terms of performance, and size. Our app (which is much much bigger than the todo app) has a very respectable load time when it production mode while running off localhost.

Re: Sproutcore vs jQuery +backbone.js

#35

To 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…

We've been using backbone for few of our projects. Here is a prototype we are working on right now: http://whiteboard.couchone.com/whiteboard/_design/whiteboard... it sits on top of the couchdb/couchapp. We did spend some time evaluating different options before we started (including SproutCore and JavascriptMVC). The main reason we decided to go with Backbone is that it's so much lighter. You can actually open the source and understand what is going on. You can plug in your own UI and templating engine easily. Backbone basically allows you to glue different elements together via Backbone's model/collection architecture (it's almost like a real backbone connecting different body pieces together :)).

Re: Sproutcore vs jQuery +backbone.js

#36
post #27

Earlier quoted context omitted.

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.…

So given: 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:c…

I've found myself wanting this, too - I sometimes get confused as to which features I can use between models and collections.i

Re: Sproutcore vs jQuery +backbone.js

#37
post #6

To 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…

How dependent is backbone on jQuery? I see that the docs mention zepto as an alternative to jQuery for backbone.view, how hard would it be to extend that to other libraries? jQuery sits pretty much at one end of the libraries spectrum, being mostly a DSL about dom manipulation. So if you want a bit more structure by using e.g. YUI or MooTools, would there be any big issues?

I've got to +1 for YUI3.

I started researching the space for building real Javascript applications fully biased on doing it with x and JQuery. But after a bit of research and prototyping I was sold on the quality and coverage of YUI.

- It has simplified DOM selectors like JQuery

- A solid Base class to extend for everything

- A fully extensible widget class/lifecycle

- Datatable has just hit beta http://developer.yahoo.com/yui/3/datatable/

Re: Sproutcore vs jQuery +backbone.js

#38
post #22

To 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…

Dealing with sophisticated configurations of nested models and collections is definitely something that Backbone should be making easier than it is at the moment. I think it would be a great feature to improve for the next release.

At the moment, the reason we've held off from any of the proposals, is that they all seem to tightly constrain your data structures and/or patterns of use. You can:

* Encode the model type into the JSON data, assuming that arrays map to collections, and nested objects map to models (not always the case).

* Employ some sort of mapping function that walks over the incoming JSON data (already possible with "parse").

And there are still a number of open questions:

* Does saving an inner model save everything in the outer model as well?

* How do nested model updates play with RESTful URLs?

* Can I refresh a portion of a nested model from the server-side?

* Do I have to adopt some sort of JSON-Path notation to be able to refer to specific attributes of nested models?

For these reasons, we've left nested models and collections as something you can choose to implement yourself, as best fits your app. If a good pattern emerges with consensus behind it, I'd love to roll it in to Backbone proper.

For the record, DocumentCloud uses a lot of nested collections on models that are lazy loaded and lazy rendered when the data is first requested. For example: displaying all of the annotations on a document, or a gallery of all the document's page images.

Re: Sproutcore vs jQuery +backbone.js

#39
post #5

To 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 documentation for Backbone looks good and includes examples. Much (all?) of the SproutCore documentation does not include examples, leaving you to rely on their IRC channel for help. At least for me, quality documentation is very important!

For good Sproutcore documentation, I found these links helpful:

http://guides.sproutcore.com/

http://devmt.hku.nl/~sproutcore/doku.php

Re: Sproutcore vs jQuery +backbone.js

#40
post #6

Earlier quoted context omitted.

How dependent is backbone on jQuery? I see that the docs mention zepto as an alternative to jQuery for backbone.view, how hard would it be to extend that to other libraries? jQuery sits pretty much at one end of the libraries spectrum, being mostly a DSL about dom manipulation. So if you want a bit more structure by using e.g. YUI or MooTools, would there be any big issues?

someone forked a MooTools version, so it is doable. Zepto is a lighter-weight jQuery compatible library- so you shouldn't feel as bad about having it as a dependency. It might also be possible to have a stripped build of jQuery.

That would be here: https://github.com/jeromegn/backbone-mootools
Post reply on HN