A code without a proper structure is a pain to maintain. Though JQuery and MooTools can be utilized to develop amazing user interfaces and web applications, building a complex client side application, requires a structured work flow.
Four Major parts of Backbone JS
Though MVC stands for Model View Controller, backbone has a slightly different structure. It is built around four major parts namely, Model, View, Collection and Controller.
With respect to backbone, a model is responsible for managing the data from the database and performing business logic around the data.
A view has a slightly different role when compared to a traditional MVC framework. It listens to the DOM events and model events and renders the data to the users.
As its name suggests, a collection is a collection of models. In simple words, it holds the collection of database results, represented by a specific model.
A controller tipycally takes the role of routing or redirecting the view to different functions, based on keywords.
When should you use backbone js?
- It is ideal for making single page web applications.
- It can come in handy to keep multiple clients and servers synchronized in a web portal.
- Comes in handy for those looking to make efficient portals and are relatively new to world of web development.
Benefits of using backbone.js
- You can store all data in models thereby eliminating the complications of DOM (document object model)
There are a lot of options open for changes and customizations and getting a hang in the initial stages can be a little tough. However, with so many tutorials available over the web, one can easily master its use and put it to the right purpose. It has been adopted by some popular web portals that are fully functional and loaded with exciting features. LinkedIn mobile, Pinterest, WordPress, Bit Torrent and Foursquare are some of the leading and popular portals that are built using backbone JS.