1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    5
    Answers
    1
    Vote Rating
    0
    sacheie is on a distinguished road

      0  

    Question Unanswered: How to structure an application overall? Are there comprehensive documents on this?

    Unanswered: How to structure an application overall? Are there comprehensive documents on this?


    Hello coders,
    Reading the Sencha Touch 2 documentation, I am having a hard time learning how to structure an application overall, and getting the big picture view of the framework. The isolated nature of the code examples exacerbates this problem: for example, many of the examples implement everything in app.js, but obviously in a real application I want to define my various MVC classes in separate files. Often, I feel like the flexible and declarative nature of the framework is actually making it harder to understand. Here are some examples of the kinds of questions that bother me as I work with Sencha:

    - Should I be implementing classes with Ext.define or Ext.create? Can I use either one, with slight adaptations? What are the reasons for using one rather than the other?

    - When should I extend built-in components? When should I simply use instances of built-in components? What is the exact relationship between components and views?

    - Where should I define proxies - in the associated model's definition, or the associated store? Is there a difference? I have seen both methods used in the examples.

    My point here is not merely to answer these specific questions; my point is that they demonstrate the gaps in the overall picture provided to me by the documentation. Reading example source code (or demo app source) is not helpful enough, because there are too many different ways of doing things: often the example is doing what I want but in a way that doesn't fit my app's structure, or in a way that leaves it unclear how to integrate the behavior with the rest of my app. What I would love is a large document that explains Ext JS4 and Sencha Touch comprehensively, in a way that would provide guidance for building a real application. If there is no such integrated source of information, I'd love to hear how experienced Sencha users approach this question. My gratitude in advance!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,649
    Answers
    3454
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Architecture is totally up to you. If something is going to be reused then it is a good candidate for using Ext.define or if you want a certain view to be stripped out and have it's own xtype then you should use Ext.define. I am very verbose to what I make into it's own class but you have to be careful not to overdo it. For example, say you have a form, I would create it's own class definition and specify what items it will have but the fields shouldn't be their own class unless it's like a Select field that you configure and are going to reuse in different classes.

    Every class created with Ext.define should have it's own file and a descriptive namespace. For example, Sencha.view.email.List would describe that the view is a list of emails. Sencha.view.user.Detail would say it is going to show details of a user.

    Your file structure should match your class name structure. The root of your namespace (name config in Ext.application, Sencha in my example) should be mapped to the appFolder config of Ext.application which defaults to the app folder. Sencha.view.email.List should be in the app/view/email/List.js file. This is also case-sensitive.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Answers
    28
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Hi sachei. What mitchell told you is not entirely true. We do believe in a common file structure and application architecture that you should follow. Unfortunately some of the guides we have written for this are a bit outdated and don't make use of some of the more advanced features of the new MVC package.

    These 3 articles are targeted to Ext JS MVC package, which is very similar to the Touch one.
    http://www.sencha.com/learn/architec...t-js-4-part-1/
    http://www.sencha.com/learn/architec...t-js-4-part-3/
    http://www.sencha.com/learn/architec...t-js-4-part-3/

    These are two conference sessions that discuss application architecture.
    http://vimeo.com/33311074
    http://vimeo.com/33430731

    Now, once you have read and watched these, you can mostly use the same concepts with our new (PR4+) MVC package except for some minor syntax differences and new features. When you try to use deprecated methods or properties we throw warnings, so you should be able to pick up on these new conventions pretty quickly.

    We will be working hard on getting all this information into a complete MVC/Architecture reference guide that is up to date with the newest (and final ) MVC package.

    If you have any more questions on specific areas within the architecture, please let me know and I'll try to answer you.

    Best,
    Tommy

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,649
    Answers
    3454
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by TommyMaintz View Post
    Hi sachei. What mitchell told you is not entirely true. We do believe in a common file structure and application architecture that you should follow. Unfortunately some of the guides we have written for this are a bit outdated and don't make use of some of the more advanced features of the new MVC package.
    Not sure why what I said is incorrect from what you state here.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Answers
    28
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    I only meant your very first sentence "Architecture is totally up to you." That sounds like we don't have any recommendations on what the architecture should look like. The rest of your post was entirely correct :p

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,649
    Answers
    3454
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by TommyMaintz View Post
    I only meant your very first sentence "Architecture is totally up to you." That sounds like we don't have any recommendations on what the architecture should look like. The rest of your post was entirely correct :p
    Ah, gotcha! I wrote that as we don't force people to do one way. We have recommendations but the is more than one way.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  7. #7
    Sencha User
    Join Date
    Feb 2012
    Location
    Paris
    Posts
    108
    Answers
    2
    Vote Rating
    1
    Tchinkatchuk is on a distinguished road

      0  

    Default


    I totally agree with sachele.
    The doc seems good and i know how hard it is to write it correctly.
    But most of the examples are messy, I think because of differents Betas and PRs.

    I'm not saying that it is bad but only that I feel lots too between docs and examples showing differents structures and organization.