2 Replies Latest reply on Jun 2, 2014 2:58 AM by RandomReado

    Large Application - Should I be using modules?

    RandomReado Level 1

      I have built an Estate Agency application in Flex 4.6 which is solely used internally.


      Each process within the application, such as editing property information, is handled within a component and some components have sub-components which are loaded via a ViewStack, such as the customer account component which has sub-components like "address information", "summary", etc.


      The problem is when a large component is loaded for the first time which has multiple sub-components, such as the customer account component, data is fetched from the server application (which takes 200ms) and populated into the various TextInput/DataGrid/DropDownList components within the customer account component and its sub-components. This results in the entire application hanging until the components have been populated.


      Is there a way to prevent this from happening, such as being able to load the component and its sub-components in the background, allowing the user to continue using the application in the foreground?


      Would it be more beneficial to use modules instead of components so the code is loaded from a separate SWF?


      Any help and advice would be greatly appreciated. Thanks in advance.

        • 1. Re: Large Application - Should I be using modules?
          Flex harUI Adobe Employee

          IMO, If your application is large, modules will likely help in ease of development, load time, and memory management.


          As far as initializing a lot of components and stuffing them with data, I don't think it will matter too much if the components are in a module or not.  You are correct that you want to try to do it in the "background" although there is no official background processing in Flash/Flex.


          IMO, it comes down to whether you really can do all of that work of initializing "all" of the components fast enough.  If you can guess you're going to need those components then you can get a head start, but will you know soon enough to finish before the user starts complaining about waiting?  If you think you can, then one technique folks use is to only initialize a few components at a time.  Use states or pure AS to add and initialize "some" of the components and when they are initialized, do a few more.


          Also consider whether all of these components fit on the screen or not.  If there are components that are not immediately on screen consider initializing them later.


          Another thing worth doing is using the profiler.  Several times I've seen folks go through extra validation passes in the LayoutManager than can often be avoided and save bit on initialization time.


          A final technique is to give up and choose to distract the user instead.  The simplest form of that is giving them something to read while everything else is going on behind the scenes.


          Good luck,


          • 2. Re: Large Application - Should I be using modules?
            RandomReado Level 1

            Brilliant - very informative answer. Thanks Alex.