With a simple application like the one we wrote with jQuery, the logic can turn into spaghetti-code rather quickly. We need to implement good practices to organize our code. Which practices do we implement? One of the first libraries to try to answer this question is Backbone.js.
Backbone.js is one of the earliest JavaScript libraries to implement a Model View Controller (MVC) architecture. MVC organizes code by separating data and business logic (the Model
) from the output (the View
) and updates both through a separate component (the Controller
). With MVC, you don't write a complicated JavaScript function that gets input from some text blanks, adds the contents together, and saves the results. Those three actions can be written into three different functions, separated by what they do and how they fit into the Model
, View
, and Controller
classifications.
Backbone.js requires a couple of other libraries in order to work properly. Backbone uses jQuery to handle DOM...