View Full Version : Extending in ext 4

31 Oct 2012, 1:43 AM
I know the way we extend has changed in version 4.

But is it a mandatory change?

I mean in my code even if I use old way of extending, it still works in version 4. So I was confused about this

31 Oct 2012, 1:52 AM
If you wish, you can also use Javascript to extend. However, Ext.define makes it much simpler to both extend and later to work with the newly created class.

There is more to Ext.define than old-school extending (e.g. using with Ext.Loader, compatibility with MVC) so I highly suggest you upgrade your code.

For more info, please visit Ext.define documentation (http://docs.sencha.com/ext-js/4-1/#!/api/Ext-method-define) and Class manager source code (http://docs.sencha.com/ext-js/4-1/source/ClassManager.html). Reading the source reveals more than any documentation ;)

31 Oct 2012, 1:57 AM
I can understand it smiplifies things but is it code-breaking change? As in if we use old way of extending, code would break?

31 Oct 2012, 2:53 AM
Yes, certain features will break.

Again, the framework is based on Javascript so you can always use the core language instead of the framework. Knowing your app infrastructure is the key to the answer here.

Employing coding standards and best practices is the way to go. I cannot encourage you to not use Ext.define, sorry.