Overview of backbone, nodejs etc

Can someone give me a birds eye view of backbone, nodejs etc.

How do these different technologies/frameworks fit together.

Meaning, if I use nodejs, do I have to use backbone?

What about cofeescript, does it work with backbone?

Node.js allows you to write server-side javascript : the code that reads an HTTP requests, and produces a response is written un javascript and executed by Google V8.

Why would you want to write your server side code in JS ?

  • Google V8 has become fast enough so that it is not too CPU intensive nowdays
  • It's really easy to manipulate JSON in JS so if you want to create an API...
  • Javascript (and node) event driven approach really helps create streaming application (sending data to the client as soon as they are made ready by the application)

Backbone.js is a client-side MVC framework written in Javascript. It allows you to write models, views, routes and link all of that. So that if your model changes, the views reflect those changes immediately. In a backbone.js application, you typically have only one HTML page that "just loads" the Backbone.js code you wrote, and this code generates the HTML the users sees based on the content of the backbone model.

CoffeeScript is just another way to write javascript. Instead of writing plain javascript, you can write CoffeeScript instead and use a translator that will convert your CoffeeScript code into javascript. You then execute the generated javascript. Benefits are : - You may prefer CoffeeScript syntax - CoffeeScript translator generates quite good javascript But in the end, it's just a matter of preference

How does all of this come together ? You can write a Node.js web application (really, just an API) in CoffeeScript (or JavaScript), that would feed JSON data to a Backbone.js application that you created (in Javascript or in CoffeeScript or both). All of your development would be done in Javascript/CoffeeScript and in the end, you Backbone.js client app would simply be another user of you Node.js API.

  • node.js allows programming at the local or server level by compiling and running javascript in the v8 engine.
  • Backbone.js is totally separate, and is for viewmodeling and modeling, as well as javascript utilities.
  • Coffescript enables abbreviated syntax for javascript. Coffescript can be used with backbone.js; See: Get started with Backbone and CoffeeScript