Live data from Hacker News

Our First Node.js App: Backbone on the Client and Server

nerds.airbnb.com

31–40 of 69 posts

Re: Our First Node.js App: Backbone on the Client and Server

#31

This is exactly what I've been waiting for. I can't wait til this is open-sourced! Was just thinking about trying out Angular because Backbone just wasn't cutting it, but this is going to make me hold out. Random piece of feedback: it's weird to use data-model_id (instead of data-model-id). I assume you're trying to match some pre-existing naming convention (but JS tends towards camelCase anyways...), but I think it…

> Random piece of feedback: it's weird to use data-model_id (instead of data-model-id)

I have thought about this one too in my own applications, and I seem to switch back and forth.

The good thing about using underscore is that the variable name can match on both sides of the expression:

    var model_id = $foo.data('model_id');
vs

    var model_id = $foo.data('model-id');
Mixing camelCase with dash seems a bit weird for me, because now there is a delimiter delimited, and case delimited convention: `data-modelId`.

I am trying to use camelCase for new code in other parts of the code though, as it seems to be the general convention in JS. [0]

[0] http://ozmm.org/posts/javascript_style.html

Re: Our First Node.js App: Backbone on the Client and Server

#32

This is exactly what I've been waiting for. I can't wait til this is open-sourced! Was just thinking about trying out Angular because Backbone just wasn't cutting it, but this is going to make me hold out. Random piece of feedback: it's weird to use data-model_id (instead of data-model-id). I assume you're trying to match some pre-existing naming convention (but JS tends towards camelCase anyways...), but I think it…

> Random piece of feedback: it's weird to use data-model_id (instead of data-model-id) I have thought about this one too in my own applications, and I seem to switch back and forth. The good thing about using underscore is that the variable name can match on both sides of the expression: var model_id = $foo.data('model_id'); vs var model_id = $foo.data('model-id'); Mixing camelCase with dash seems a bit weird for me,…

Yeah, it's unfortunate that all of Javascript uses camelCase instead of underscores, but since it does I'd rather use it everywhere, instead of using underscores when they aren't standard in either Javascript or HTML.

Re: Our First Node.js App: Backbone on the Client and Server

#33
Great article, especially in coming up with a clean way to reaching the holy grail. I remember seeing in Spike's tech talk some months back that they initially chose DerbyJS, but it seems from the blog post that they went with Express instead. Curious to find out why.

Re: Our First Node.js App: Backbone on the Client and Server

#35
post #21

It's worth pointing out that DerbyJS already renders on the server and the client without any configuration. I implore you all to give it a shot. For an example, visit http://phishvids.com – try clicking around and then refreshing or even disabling javascript. [0] http://derbyjs.com

DerbyJS is a pretty cool project. I was checking it out a while ago but there was no way to hide private data (user details etc) from the client. It seems they have made a start on that now though[0]. Might be time to take another look.

[0] https://github.com/codeparty/racer/blob/master/lib/accessCon...

Re: Our First Node.js App: Backbone on the Client and Server

#36

Earlier quoted context omitted.

Jashkenas, do you have any plans to venture into this area? I was just talking today about how I am tempted to try some of the other libraries that are going this direction. But that whenever I look at their code I'm envious of how clean Backbone is. Seriously the biggest turn-off to Angular is reading the code and seeing that people aren't as nit-picky, pseudo-OCD, whatever you want to call it as you are. Just curio…

I've got no immediate plans to play around with any Backbone-on-the-client-and-server stuff ... the next web app library in the works is only semi-related: The basic idea is that for many public-facing websites (think NYTimes, natch, or Airbnb's search result listings, for example), the usual Rails convention of "Hey, here comes a request, let me generate a page just for you", is fairly inappropriate. Lots of "publis…

Your comment reminds me of a CMS-like system I built over a decade ago based on plain old unix 'make'. 'make' tracked all the dependencies to determine what parts of the site needed to be updated when new content was added or updated. Content was authored unstyled in a simplified subset of html, and make ran it through an XSLT to do styling and aggregation, like to build indices. The whole thing worked very well, building over 2k pages in seconds. I still miss it!

Re: Our First Node.js App: Backbone on the Client and Server

#37

Earlier quoted context omitted.

Jashkenas, do you have any plans to venture into this area? I was just talking today about how I am tempted to try some of the other libraries that are going this direction. But that whenever I look at their code I'm envious of how clean Backbone is. Seriously the biggest turn-off to Angular is reading the code and seeing that people aren't as nit-picky, pseudo-OCD, whatever you want to call it as you are. Just curio…

I've got no immediate plans to play around with any Backbone-on-the-client-and-server stuff ... the next web app library in the works is only semi-related: The basic idea is that for many public-facing websites (think NYTimes, natch, or Airbnb's search result listings, for example), the usual Rails convention of "Hey, here comes a request, let me generate a page just for you", is fairly inappropriate. Lots of "publis…

> "Hey, here comes a request, let me generate a page just for you"

In a blogging context, stuff like Wordpress where pages are generated per request, then cached to handle any form of serious load just rubs me the wrong way... Such an infrastructure to display a few pages seems ludicrous.

> The default would be to bake out static resources when data changes, and you'd want to automatically track all of the data flows and dependencies within the application. So when your user submits a change, or your cron picks up new data from the FEC, or when your editor hits "publish", all of the bits that need to be updated get generated right then.

... so this is exactly what my WIP custom blog engine (ultimately meant to replace my posterous blog) looks like, initially composed of markdown source and makefiles, then ramped up to some rake tasks and a ruby library. An entity change (edit post, add comment...) should trigger generation of each page referencing it exactly once, and possibly immediately.

Re: Our First Node.js App: Backbone on the Client and Server

#38

I was lucky to be able to catch a preview presentation of this "Holy Grail" project at SpainJS, last summer. It's very interesting stuff. I think that one of the more important caveats to mention is that to the extent that your application is composed of rich interactions, visualizations and interactivity, and logged-in-user-only content, that stuff tends to remain on the client-side alone ... but for your basic rend…

Author here (spikebrehm): Jeremy, I think you're mistaking this for Keith Norman's SpainJS presentation ( http://www.youtube.com/watch?v=jbn9c_yfuoM ). He proposes the same approach, but I don't know if it ever got past a demo. Although it seems like they may be using some form of this at Groupon in production. Anyway, it is exciting, isn't it? This is just the beginning for us -- we've had to make a few hacky design…

Very interesting stuff :) Can't wait to hear more on this, as it seems like the panacea we've been slowly moving towards for some time.

How does the approach you've taken compare with the architecture outlined in nodejitsu's concept of isomorphic JS?

http://blog.nodejitsu.com/scaling-isomorphic-javascript-code

Re: Our First Node.js App: Backbone on the Client and Server

#39

I was lucky to be able to catch a preview presentation of this "Holy Grail" project at SpainJS, last summer. It's very interesting stuff. I think that one of the more important caveats to mention is that to the extent that your application is composed of rich interactions, visualizations and interactivity, and logged-in-user-only content, that stuff tends to remain on the client-side alone ... but for your basic rend…

Author here (spikebrehm): Jeremy, I think you're mistaking this for Keith Norman's SpainJS presentation ( http://www.youtube.com/watch?v=jbn9c_yfuoM ). He proposes the same approach, but I don't know if it ever got past a demo. Although it seems like they may be using some form of this at Groupon in production. Anyway, it is exciting, isn't it? This is just the beginning for us -- we've had to make a few hacky design…

Oh my goodness. I totally am mistaking it for that presentation. It's the same general concept, and they also called it the "Holy Grail". Apologies for the confusion.

Y'all should get together and compare notes ;)

Post reply on HN