backbone.js has caught my interest recently as I was developing a webapp. Now I am starting a new app and is considering learning about backbone.js. I’m 1/3 of the way through a 3 part screencast tutorial on making a music player and my impressions are that the setting up of models and views were quite confusing and tedious. I am developing in PHP/Codeigniter framework so I guess I have an idea of how MVC will help me.
But if I want to develop an single page (multiple tabs) app say, for store owners to manage their inventory, it can uses tabs that shows Dashboard, Inventory, Supplies, Sales, Assistants, Store Branches. Wouldn’t a serverside backend with jQuery be sufficient without backbone.js? jQuery can hide display the different tab views, handle the interaction of UI elements, send and retrieve AJAX calls, manage modal dialogs… Why should I use collections and views when I can use arrays? In this case, how will using backbone.js help in developing this app?
Of course, you could build your app yourself using jquery or even plain ol’ javascript. It completely depends on the complexity of what you’re trying to achieve.
Backbone is aimed at creating rich, single page apps. As such, it provides a structured means for describing, grouping and handling your data. Routing for application state, templated views etc. For example, collections (of models) provide so much more than arrays. They can be bound directly to your views, observe changes and automatically sync to the server with very little “glue” code.
If you’re going to put much of your application logic in the browser on the client side, you need to keep it structured and organised. Backbone.js, and several other rich js frameworks do this very well.