In this chapter, we begin by looking back over everything we've covered in the previous chapters. We then look at how Backbone is being used to power a real-world medical application, and finally, we look forward to how you can continue your Backbone education. In particular we will cover the following:
In the first half of this book, we examined the four Backbone classes (Collection
, Model
, Router
, and View
), and how each of them fit together to build a web application. To refresh, a Backbone-powered site starts with a Router
class, which is used to map URLs to the virtual pages of the application. Router
makes up half of the MVC Controller
layer, while the View
class makes up the other half. The View
class is also responsible for the MVC View
layer of a web application, as View
classes both render the pages that make up the site and listen for and respond to user-generated events.
Of course, a data or MVC Model
layer is also essential for almost any application, and this layer is handled by the Model
and Collection
classes. Model
classes, which represent individual data objects, are used both to manage data on the client-side and to send and receive data to and from the server. Collection
classes hold sets of Model
classes but are otherwise used similarly to manage data and transmit it to/from the server. Model
and Collection
classes are used primarily by View
classes, which render their data into DOM elements.
All of these classes are designed not just to be used directly but also to be extended into new subclasses with logic specific to your application. This same extension mechanism is used by third-party Backbone libraries, such as BackGrid and BackSupport, to provide components that further extend the capabilities of your application. However, Backbone-specific libraries aren't the only third-party libraries that you can use in your Backbone application. By wrapping non-Backbone components with your own custom Backbone classes, you can cleanly incorporate tools such as a template system or a jQuery UI widget in to your application. Even libraries that can't be wrapped in a Backbone class, such as Underscore, RequireJS, or Mocha, can be used independently to add functionality without losing any of the benefits of Backbone itself.
This, in short, summarizes everything we've learned so far, but as we covered that information originally, we kept our focus on component at a time. As we finish this book, it would be beneficial to look at how all these pieces can be used together to implement a real-world use case. That use case is Syapse.
3.94.202.151