View Full Version : Dynamic architectures: MVC or Ext Loader? Ext.application or Ext.onReady?

26 Aug 2011, 3:04 AM
I am trying to make an architectural decision on whether to use MVC, or the more traditional Ext.onReady model with Ext Loader.

We have a larg-ish system where available menus vary by user role, and can change at run time (based on admin updates). Also, many of the views have grid fields which can vary based on the definition in a database.

As a result, we cannot define the datastores or controllers at user logon.

When looking into this on ExtJS, I got the impression that either the stores, or the controllers have to be defined in the Ext.application entry point. Is this correct?
Are there any work arounds to this? (eg. nesting one application in another, or defining controllers/stores on a view by view basis).

Are there any dicussion materials or best practice examples on the architectural issues here? I did see Mr. Garcia's article on Ext Loader, but I was not clear how evaluate this against in the light of MVC.
Are there other consideration here, - eg. any plan to retire the traditional approach in favour of MVC?
(I can see how MVC can be great in other applications where offline capability is being considered, or wrapping Sencha applications like Phonegap does).

Many thanks,

26 Aug 2011, 5:06 AM
Ext.Loader should not be used in production. The reason for this is it's inefficient to open a new socket for every file. Ext.Loader is best used for development in conjunction with MVC. When you have created your MVC application, the last step before deployment is running the build using the SDK Tools. This will create a custom Ext JS 4.x build and your application files. It does this by means of using the requires and uses and all that jazz.

26 Aug 2011, 9:17 AM
Hi Mitchell,
Thank you for the information about the build. I did not realise that.
However, I am not sure it is relevant in our case, as we can't make a build at release time.
On our system, the screens are mostly built at run-time (generated dynamically from a database).
So we tend to have very few .js files, and most of the Ext.* definitions are put as <script... tags in html, or loaded dynamically in response to requests.
The main thing I wanted to clarify is if MVC needs to have definitions for everything at startup (in Ext.application), or if we can dynamically pull in views and controllers on the fly.

Kind regards,

26 Aug 2011, 10:11 AM
In your case, MVC may not be ideal. I would still not recommend that you create a script tag for each class in production.