My journey with Backbone
What is backbone?
Does this sound familiar?
If your reaction to that scenario was, “yea thats me” then you’ve been a victim of spaghetti code.
In comes Backbone!
What backbone does is that it provides you with the power to structure to your application. It provides models with key-value pairs, views with event handling capabilities, and a collection (of models) that can handle events associated with groups of models.
By isolating each of these different components, what happens is that you get to handle everything in an orderly fashion. Data is represented as a model, which can be created, persisted to a server or destroyed. When a user action changes a model attribute, the model triggers a “change event”.
This action notifies all the views that display the changed model, so that they can render themselves appropriately.
The C in an MVC framework usually stands for Controller but the “C” in backbone stands for a collection. a collection, as it is aptly termed, holds groups of models together. Change events can be bound to collections, and are triggered when anything changes within any of the models that belong to said collection.
All of this rendering and re-rendering is handled by backbone automatically, which means you and i dont have less to worry about
My journey with backbone, albeit a short one introduced me to a whole new way of viewing front end work. after writing tons and tons of spaghetti code, it was a relief to find that i could create rich client side applications that had structure, which meant i didn’t have to dread making changes in the future.