Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Major changes to MVC in ExtJS4.2?

I recently heard that there are some major changes coming up with 4.2 concerning the way a MVC application work. I downloaded the beta but the API seems all in all the same. Can anyone explain me the upcoming changes and what thats all about? Do I need to fear that all my controllers will stop working if I update?

like image 649
seba Avatar asked Dec 22 '12 08:12

seba


1 Answers

Yes, I would call the changes we've made to MVC in 4.2 pretty major; however backwards compatibility has always been our priority. I do acknowledge that prior to 4.2 there were many long unsolved problems with MVC implementation and that prompted people to jump through all kinds of hoops to do what they needed. We've been trying to resolve these and streamline MVC experience, along with adding several features aimed at devs who have big apps on their hands. 4.2 beta 2 will include most of these, and we'd love to hear your feedback on them.

I plan to write up on these improvements before 4.2 is released, but here's a quick list:

  • Ext.app.EventBus, like @sra mentioned, is now a singleton, and is always available in your application - although it doesn't make much sense to use it directly
  • Ext.app.Controller no longer depends on Ext.app.Application to do things, and can be instantiated without bringing up the whole dependency tree - which means you can unit test your Controllers!
  • It is now possible to create your own Application class(es) extending from Ext.app.Application, and include your logic in this class
  • Ext.application() no longer does unspeakable black magic; when passed your Application class name it just instantiates it. If you pass it a config object like before, it will declare new Application class with these config options, and instantiate it - same logic as above, a bit different execution
  • As the result of two items above, Ext.application() no longer requires all your dependency tree synchronously (it used to), so that's one thing to watch for
  • It is now possible to explicitly declare all namespaces (project parts) in your Application class, to avoid any kind of ambiguities when resolving dependencies
  • Ext.app.Application now deals properly with its own ancestry and can be used as a top level Controller in your application
  • A new concept of event domains was introduced; it is now possible to fire and listen to events not related to Components. We provide several domains out of the box, and it's easy to add your own - something like I described in my article some time ago, but cleaner and more powerful

There were some more little improvements and hacks for backwards compatibility, mostly concerned with dependency tracking. These should not trip you if you don't do something overly crazy. If you do, that's what Betas are for. :)

Hope this helps!

like image 107
Alex Tokarev Avatar answered Sep 29 '22 10:09

Alex Tokarev