Results 1 to 3 of 3

Thread: Why do you want these config arrays to contain unqualified names?

  1. #1
    Sencha User
    Join Date
    Sep 2010
    Vote Rating

    Default Why do you want these config arrays to contain unqualified names?

    From the new 4.2 docs

    Request clarification please.

    The list of namespace prefixes used in the application to resolve dependencies like Views and Stores:
    You don't need to include main namespace (MyApp), it will be added to the list automatically.
         name: 'MyApp',
         namespaces: ['Common.code'],
         controllers: [ 'Common.code.controller.Foo', 'Bar' ]
     Ext.define('Common.code.controller.Foo', {
         extend: '',
         models: ['Foo'],    // Loads Common.code.model.Foo
         views:  ['Bar']     // Loads Common.code.view.Bar
     Ext.define('MyApp.controller.Bar', {
         extend: '',
         models: ['Foo'],    // Loads MyApp.model.Foo
         views:  ['Bar']     // Loads MyApp.view.Bar
    There is a fair bit of discussion in the docs, I have had pain here as I learned.
    So it is hard to be certain what was due to ignorance vs what is now fixed or improved.

    May I ask, what is the point here, why are we doing this?

    a) we get setters and setters "for free".
    b) models and stores are instantiated in the getter if they do not exist. But not views. this is shorthand for requiring and creating?

    Why is it that you want these config arrays to contain unqualified names?

    There are so many places to "resolve dependencies" I have lost it.
    Changing one upsets the others and around in circles I go.
    The application has name, namespaces, paths, appfolder and now this.
    And still the dependencies are a problem.

    Yet there they are in an organized files system.

    I do not have a great deal of real-world experience (I can't get a fricking product out the door), but it seems to me it would be very simple to have one namespace and I reach into it by completely specifying a path. If I want cool/code/controller.js then I write require [''cool.code.Controller'].

    Why the complications and automation?
    What does this buy me?
    Why do I want to hide information from myself?

    models: ['Foo'], // Loads Common.code.model.Foo Surprise!! You thought it was something else!

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    It assumes you are using the same namespace as the class you are in which is valid for the exact same reason you are using. If you have a controller that is not under your application's namespace, so it could be a shared class, then you have to assume the models and stores you specify are under the same namespace of that shared class. If you assume it is the same as your application class then that can break your shared class assumption.

    I personally do not use the models, stores and views properties on controllers anymore. For models and stores is because they are made global so that means (to me) that Application would need to require them; only case against this is if you are requiring a shared namespace class in which I would want it to require other same namespace files. For views, for the most part other views should be requiring other views, a controller shouldn't be requiring a view; only exception is if the view would never belong to a parent.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:

  3. #3
    Sencha User
    Join Date
    Sep 2010
    Vote Rating


    You went a little fast for me there but I think I got the jist.

    I have a workspace and several apps and I am trying to share classes.

    So it's all about "assumptions". Meaning it is just shorthand.

    If I always fully qualify then I don't worry about it ?

    I don't see a clear advantage to ['Fred'] over ['']

    I grow weary of magic, assumptions and automation at this early stage. I think that stuff is great only once you have bumped into all the 'assumptions' personally and know what's going to happen. I only bring it up in case I am missing something vital. Your answer seems to say don't sweat it.

    I will let is pass. Thanks for your answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts