thoughtbot / backbone-js-on-rails

Backbone.js on Rails
Other
27 stars 1 forks source link

Discuss client vs server task distribution #39

Closed jasonm closed 12 years ago

jasonm commented 13 years ago

One conversation I've had on a recurring basis is about how to decide where to perform various tasks - or if a spread of business logic across client and server even makes sense at all (given that it can lead to duplication).

At fist, I would discuss this distinction in terms of performance, but that's a weak argument as modern JS engines are actually very powerful. In reality, the primary distinction is trust; trusted computations may be performed by the client, and nontrusted computations (authentication, authorization, resource allocation and accounting, payment) must be performed by the server. Email+password authentication is an easy example, and we can clearly illustrate the binding from server to client-side with e.g. TaskApp.init({ user: new User(<%== current_user.to_json %>) });

There should be a section dedicated to this discussion, and it should be reflected through example in the example application.

jasonm commented 12 years ago

This is covered in client_server_duplication chapter