Chapter 7. Leveraging the Model-View-Controller

 

This chapter covers

  • Comparing pure jQuery to MVC
  • Learning about MVC in JavaScript
  • Introducing Backbone
  • Building Backbone applications
  • Looking at shared-view rendering in the server and browser

Until now, we’ve discussed topics around application development, such as crafting a build process. We also talked about code-related topics, such as coherent asynchronous flows and modular application design. We haven’t yet covered the bulk of an application itself, which is what we’ll do in this chapter. I’ll explain why jQuery, a popular library that makes interacting with the DOM easier, might be lacking for large-scale application design and what tools you can use to supplement it or how to replace it entirely. You’ll look at developing an application using the Model-View-Controller (MVC) design pattern, and you’ll create an application to manage a list of to-do items throughout the chapter.

Like modularity, MVC improves software quality by separating concerns. In the case of MVC, this separation is split into three types of modules: Models, Views, and Controllers. These parts are interconnected to separate internal information representation (Models, what the developer understands) from the presentation layer (Views, what the user sees) from the logic that connects both representations of the same data (Controllers, which also help validate user data and decide what views to show them).

7.1. jQuery isn’t enough

 
 
 

7.2. Model-View-Controller in JavaScript

 
 
 
 

7.3. Introduction to Backbone

 
 
 
 

7.4. Case study: the shopping list

 
 

7.5. Backbone and Rendr: server/client shared rendering

 
 

7.6. Summary

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest