Rendr - Use Backbone on both the server and client
11–20 of 35 posts
Re: Rendr - Use Backbone on both the server and client
#12I don't like the idea of rendering client code in the server.
Though, don't write your business code in javascript. Hell to maintain.
Re: Rendr - Use Backbone on both the server and client
#13I don't like the idea of rendering client code in the server.
If your definition of the JSON to HTML transformation is declarative, it makes sense to allow the server to do it for the data that's available to it.
The web has a semi-long history of "dumb clients," and that means the server has to be able to do the rendering. There are some pretty good reasons for this, and projects like Rendr try to make it as easy as possible. Seems good to me!
Re: Rendr - Use Backbone on both the server and client
#14My interpretation of the key benefits: large speed increases for users, and vastly improved SEO.
Re: Rendr - Use Backbone on both the server and client
#15But seriously, looks very much like Shopify's batman.js http://batmanjs.org
Re: Rendr - Use Backbone on both the server and client
#16Of course, it's not like rendr has any real documentation, either.
However it has been working very well for us, so it is validation of the rendr approach.
A quick glance at their documentation indicates a very similar design, comparing the two projects should be instructive.
Re: Rendr - Use Backbone on both the server and client
#17Wow, their samples sure look like Batman.js. Also, I'm a fan of them for going with CoffeeScript, they have taste. But seriously, looks very much like Shopify's batman.js http://batmanjs.org
I think most of the similarities you see stem from those two points.
But there are some massive differences:
- batman.js is Rails-style MVC, rendr is based on Backbone so you must supply your own controllers. A good argument can be made that Rails is not truely MVC, but it at least attempts to do so. rendr is MV.
- RENDR runs and renders on the server. batman.js relies on a Rails or REST app on the server.
- rendr is based on Backbone.js and Express, batman.js isn't
Re: Rendr - Use Backbone on both the server and client
#18My brother released a very similar project about 8 months ago.[1] He never did properly announce or document it so it's no surprise that nobody else is using it. Of course, it's not like rendr has any real documentation, either. However it has been working very well for us, so it is validation of the rendr approach. A quick glance at their documentation indicates a very similar design, comparing the two projects shou…
Here's a typical ViewModel definition (in JS):
foo.vm.Resource = highbrow.ViewModel.extend({
lastUpdated: function() {
return moment(this.model.get('modifiedAt')).fromNow();
}
});
foo.vm.Resource.attrs(['name', 'content']);
This shows the main two features of ViewModel's: a whitelist of attrs that the template can access directly, and a set of functions that would otherwise end up polluting your model with view side code.This decoupling dramatically improves the structure of our applications, without introducing Rails style controllers which are also totally misnamed in my opinion. Rails controllers are essentially two things: routers and MV-shims. Splitting the two makes for much improved program structure.
1: https://github.com/airbnb/rendr/blob/master/shared/base/view...
2: https://github.com/wvl/highbrow/blob/master/src/view-model.c...
Re: Rendr - Use Backbone on both the server and client
#19My brother released a very similar project about 8 months ago.[1] He never did properly announce or document it so it's no surprise that nobody else is using it. Of course, it's not like rendr has any real documentation, either. However it has been working very well for us, so it is validation of the rendr approach. A quick glance at their documentation indicates a very similar design, comparing the two projects shou…
Re: Rendr - Use Backbone on both the server and client
#20My brother released a very similar project about 8 months ago.[1] He never did properly announce or document it so it's no surprise that nobody else is using it. Of course, it's not like rendr has any real documentation, either. However it has been working very well for us, so it is validation of the rendr approach. A quick glance at their documentation indicates a very similar design, comparing the two projects shou…
* Minimize if (server) {...} else {…}
was unfortunate. A grep of the highbrow source code indicates about 10 instances of that pattern, so I don't think there's a need for a separate base/server/client directory structure like rendr has, I think that creates artificial distinctions. It may be because I'm used to reading the highbrow source (because that's the only documentation :), but I find those if/else blocks to be very illuminating.