21 Feb Enhance Speed of your web app with Backbone.js
What is Backbone.js?
- Website speed is the demand of the day. Running a website with full server dependencies, is not cost effective in terms of speed. If for each and everything we depend upon server and every request is served with a page refresh, then it will be annoying to any user. If you use MVC client architecture like Backbone.js, then most of the load on server is reduced and the website is depends on server only for getting json data and not for the logic of how to display it.
- Better user experience is needed for every website that wants more and more users to visit it. And Backbone.js provides a very good user experience, as the demand of the users are served only in the client machine. User does not need a page refresh for any action.
Advantages of Backbone.js
- Streamlined Event handling
When a project grows, the jQuery declarations and callbacks gets more complex. The code becomes more cluttered. Backbone.js overcome this problem by providing an event-driven communication between views and models. The backbone.js events build on top of regular DOM events, which makes the mechanism very versatile and extensible.
- Syncing with a back-end
The models in Backbone.js can be easily tied to a back-end. The framework provides excellent support for RESTful APIs in that models can be mapped to RESTful endpoints.
- Maintainability by following conventions
Conventions are a great way to introduce a common coding style without the need of coming up with an extensive set of coding standards. Backbone.js is particularly helpful to maintain a clean code base despite having multiple developer involved in the coding.
- Organized Code
In the MVC platform, web application depends upon server for getting json data for the logic on how to display it. Here load on server is reduced and it helps in increasing the speed of the website.
- Reduced data transfer
Normally when client searches a record from the database, it sends a request to server.And then, to render output, database starts processing and send response.
Server -> database processing-> rendering output-> Response
But with Backbone.js request will be sent only for data and data will be returned from server in json format. Those data is manipulated at client-side.
Please share your experience of implementation of Backbone.js in Rails.