MVC and the illusion of choice

Given everything we've just covered, you'd think that MVC was the holy grail of development. It's tried and tested, adaptable, and supported by Ext JS. In fact, there are some cases in which it's useful to go a little further and augment MVC.

To use Ext JS-specific examples, let's look at what happens when you start writing a more complicated application. Your controllers can react to the events that your views fire, orchestrate interactions between different views, and even stores other controllers. So, does this mean that you put your event handlers in your controllers, your views, or a combination of both?

This is a key question, which can be answered simply by being very strict with your development process from the beginning. MVC provides the "illusion of choice"; in this, it offers a large variety of ways to set up your application, but only a few that will result in a healthy application.

How about when you have a central source of data, but different views that consume it? You might want to have this data in slightly different forms for each view. Does the view itself take responsibility for shaping this data?

Ext JS 5 implements a pattern called model-view-viewmodel (MVVM) that tries to address these questions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset