The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

willy (8) [Avatar] Offline
#1
Correct me if I'm wrong:
What's the benefit of using namespaces for classes if xtypes and event do not use them?
jesus.garcia (463) [Avatar] Offline
#2
Re: benefits of using namespaces?
Events have nothing to do with namespaces. So we'll get that out of the way.

XTypes are designed for 'lazy instantiation', allowing you to construct an object literal to 'configure' a class, and the 'xtype' is used to instantiate the class registered with that xtype.

Namespaces and xtypes have somewhat of a conflict, however. Namespaces help prevent name collisions, where xtypes do not.

This is why I've started to include the entire namespace for my app classes:

Ext.reg('MyApp.userform.UserRegistrationFormPanel', MyApp.userform.UserRegistrationFormPanel);