Live data from Hacker News

Announcing Backbone.js: Models, Collections and Views in 2.4kb

documentcloud.github.com

51–60 of 62 posts

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#51

Awesome! Any plans to integrate this with coffeescript? I see someone's already taken a stab at it: http://gist.github.com/625893

It's just JavaScript, so they should work together fine:

    Todo = Backbone.Model.extend
      
      done: ->
        @get("status") is "done"

      toggle: ->
        @set status: if @done() then "active" else "done"
Doing a quick Backbone.coffee version would be fun though, hmm...

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#52

Awesome! Any plans to integrate this with coffeescript? I see someone's already taken a stab at it: http://gist.github.com/625893

It's just JavaScript, so they should work together fine: Todo = Backbone.Model.extend done: -> @get("status") is "done" toggle: -> @set status: if @done() then "active" else "done" Doing a quick Backbone.coffee version would be fun though, hmm...

TBH I was a little surprised that you didn't write this in coffee in the first place :-)

Isn't this the kind of thing that coffee would be aimed at?

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#53
post #48

Maybe I missed it but is there any kind of offline support? Ie. What happens when update to server fails? Or it's completely up to the developer?

Offline support is up to the developer -- there are many applications where the notion doesn't make sense: imagine an offline Google or and offline Twitter. But having nice logical models certainly helps organize an offline application.

The first thing you would do is override Backbone.sync to save your models to Local Storage instead of the server:

http://documentcloud.github.com/backbone/#Sync

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#55
post #32

Looks great - imagine that it would be a perfect companion to something like sammy.js

Yes, they could work together quite well. However (and this is another conversation altogether), I don't think that you really want to structure your client-side application around faux-routes. Maintaining browser history with "hashchange" is important, but hardly the central aspect of a JS app. Usually you want to reserve history changes for special states that deserve to be bookmarked, not for every single action p…

Can you please expand on this? I don't get it: do you think something like newtwitter is badly designed because it uses faux-routes? If you don't have faux-routes then how can you easily insert links which will "go to page X" ?

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#57
post #55

Earlier quoted context omitted.

Yes, they could work together quite well. However (and this is another conversation altogether), I don't think that you really want to structure your client-side application around faux-routes. Maintaining browser history with "hashchange" is important, but hardly the central aspect of a JS app. Usually you want to reserve history changes for special states that deserve to be bookmarked, not for every single action p…

Can you please expand on this? I don't get it: do you think something like newtwitter is badly designed because it uses faux-routes? If you don't have faux-routes then how can you easily insert links which will "go to page X" ?

Not at all -- hash-based URLs for Ajax applications are critical. They're just not something that you want to structure your entire application around, and Sammy is a framework that uses faux-URLs as the central abstraction.

All I'm saying is that you don't need to ape the server-side paradigm (one URL, one page) quite so closely. Use a module that gives you URL setting and tracking with "onhashchange", by all means, but you don't have to shoehorn your application into it.

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#58

Earlier quoted context omitted.

It's just JavaScript, so they should work together fine: Todo = Backbone.Model.extend done: -> @get("status") is "done" toggle: -> @set status: if @done() then "active" else "done" Doing a quick Backbone.coffee version would be fun though, hmm...

TBH I was a little surprised that you didn't write this in coffee in the first place :-) Isn't this the kind of thing that coffee would be aimed at?

Yes, and the CoffeeScript version would probably perform marginally faster. But pragmatism comes first. Because this is a part of a grant-funded project, it needs to be available and accessible to the widest possible audience -- and that means JavaScript.

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#59

This is not specifically about Backbone. How do you provide content for web crawlers/searchbots with a client framework?

Frequently, JavaScript-heavy applications are for individual use: think GMail, Basecamp, or Google Docs -- none of which need to be indexed by web crawlers.

But if you are doing something public facing, you can get it indexed by Google with a little elbow grease:

http://code.google.com/web/ajaxcrawling/docs/getting-started...

"New Twitter" takes this approach.

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#60
post #18

Would be nice to have a complete minimal web app using Backbone to get the feeling of what you can do with this.

I have made a demo app. See my blog post for code and explanation. http://afewgoodlines.com/post/1329452279/a-backbone-js-demo-...
Post reply on HN