Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: 1 [2] 3 4 ... 7
Print
Author Topic: Loadup (formerly StartupManager) - A PureMVC AS3 Utility  (Read 109717 times)
trilec
Sr. Member
****
Posts: 52



View Profile WWW Email
« Reply #15 on: April 02, 2008, 06:21:34 »

Hi, Steve/Cliff
So True, still trying to grasp pattern concepts, have only just managed to complete a multicore prototype after spending three weeks just reading forums and source code... lol
I still find it a little ambiguous as to where one would use the startup manager (I was looking for it to fulfill the role of asset pre-loader)
and may be overkill for some development, but at which point?, and as I've posted before, means a proxy would contain GUI style elements or animation which views may need to build other GUI elements (styles manager proxy loading assets)? 
(hoping with a little more research/testing I will find where it fits my needs if any)

On a side note I feel the same for needing state machine utilities and implementation guidelines, there was some good discussion about this in previous state machines posts but seems to have become quiet.

Curtis [Trilec]
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #16 on: April 03, 2008, 04:06:01 »

Steve /Trilec /.../Cliff
Evolution of startup manager, as I recollect it
  • General Discussion forum, topic: "first project with puremvc", started by danieleUg
  • read through this forum, if you want to know the full story (in excruciating detail dare I say!)
  • I think Cliff coined the name StartupMonitorProxy
  • the problem to be addressed: a number of resources to be loaded at startup, using separate asynchronous requests, manage the loading in a structured way, with a design that would have general applicability
  • Daniele created the AppSkeleton demo and this evolved to a final version, with an important contribution from meekgeek along the way; the demo includes a resource dependency feature in that resources are sequenced and a resource can be marked as blocking the load of follow-on resources until that resource has been loaded
  • I needed a more generalised solution to dependencies between resources, and enhanced the code accordingly, within my application, and presented the revised set of core classes
  • as yet, there was no utility, these were applications with some common classes and common code fragments
  • Cliff was pushing for a utility, for ease of re-use, and I set about doing that
  • meanwhile meekgeek came in with some enhancements to cater for a timeout requirement that he had
  • I incorporated the timeout feature and then an associated retry feature and also catered for the case where a resource load fails; I also built in some robustness and proper separation of utility from application
  • this became the utility, with the StartupAsOrdered demo to illustrate use of the utility.   

When is the utility appropriate?  In my case, an application with accounting data, I wanted to load a variety of data at startup, using separate asynchronous requests, this data to then form an integrated object data model, so...
  • load in-progress accounting documents, but must have chart of accounts loaded first
  • chart of accounts requires that master currency info has been loaded
  • various kinds of reference information must be loaded before any of the above
  • and so on.
So, if you want to load an integrated data model, in separate chunks, then the utility could be useful.  You must look at your particular requirements and see if it has a role.

As regards documentation of the utility
  • see the API docs, available by viewing within the manifold project environment, or by asdoc from the src in the download zip
  • the demo app is key to understanding how to use it
  • my replies to some queries earlier in this thread may be useful
  • the source code of the utility is not large
  • Steve (and others), if you would like to contribute to the documentation, that would be great.

If there are people who have used the utility and have found it worthwhile, let us know here on this forum.  That would be a great way of seeing the kinds of problem that it is suited to.  Of course, let us know if you tried it and it failed to deliver - that would be important too.
    Philip
Logged
justSteve
Courseware Beta
Sr. Member
***
Posts: 55


View Profile Email
« Reply #17 on: April 03, 2008, 05:59:25 »

Many thankx for that Philip - great overview. This answers kouri's question regarding the relationship between the quote/unquote out of dateness of AppSkeleton. It's not so much that anything in AppSkeleton is deprecated by PureMVC v2 so much as that the technique used in the latest version of AppSkeleton has since been packaged into the StartupManager utility.

The 'StartupAsOrdered' demo illustrates the problem of monitoring the loading of dependent objects and less so the process of loading assets in the more conventional (media element) sense. Since I'm going to be working on asset loading handling very soon, I'll post a demo that focuses on managing a dynamic list of .swfs.

I'd suggest that AppSkeleton be updated to reflect the same functionality that it currently has but employs the StartupManager Utility so as to avoid kouri's understandable confusion.

Backing out to a big picture for a moment - Application startup being such a huge part of the process we are really lucky to have this utility. Philip's call for others' experiences with it bears amplification. If such information could be gleaned from server logs, it might be interesting to see what happens if an email could be generated to all users who've downloaded the utility asking that folks share their reactions.

Here's one of mine, wouldn't it be reasonable to build in the means of logging 'failure to loads'? Understanding that it's close to trivial to handle this at the given proxy - it sure seems that everyone interested in using the utility is going to be intensely interested in  logging failures.

I'm digging into the API docs to see if I can bring in some of the relevant info from this and previous threads in a useful way.

thx
--steve...
Logged
dbasch
Jr. Member
**
Posts: 17


View Profile Email
« Reply #18 on: April 03, 2008, 09:56:50 »

You asked for feedback on the usage of this great little tool so here it goes:

Here is my wish list:

  • I have been messing around, using this tool, for sequential data model loading after the initial startup sequence. I often find myself wishing that I could dynamically register resources with the same singleton monitor instance instead of having to instantiate a new singleton monitor repeatedly. I imagine the sequence would go something like this:
    • Check that the singleton monitor instance isLoadingFinished is true. This is currently a private attribute and listening for the LOADING_COMPLETE notification does not work within a command (createNewMonitor command for instance) as they don't listen for notifications.
    • Set the resourceList to empty
    • Dynamically register any new proxies that we may need
    • Call monitor.loadResources
    • You essentially do these same steps when you re-instantiate the monitor so why not cut some of the overhead?

  • I often wonder why the doRetryLoadResources() function doesn't start from the resource that is AFTER the last known properly loaded resource. The other resources have loaded properly so why do we get them again?

Thanks for the great tool and hopefully this was constructive  :)

Regards,
Derek Basch
« Last Edit: April 03, 2008, 10:34:18 by dbasch » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #19 on: April 03, 2008, 10:34:11 »

Hi Derek,

Sounds reasonable. As with any open source project you are empowered to make it better!

How about checking out the trunk, making your suggested changes, test them in your app and then create a patch and post it here?

You could extend the existing demo or create another to show how it works.

-=Cliff>
Logged
dbasch
Jr. Member
**
Posts: 17


View Profile Email
« Reply #20 on: April 03, 2008, 10:38:50 »

Hi Derek,

Sounds reasonable. As with any open source project you are empowered to make it better!

How about checking out the trunk, making your suggested changes, test them in your app and then create a patch and post it here?

You could extend the existing demo or create another to show how it works.

-=Cliff>

Thanks for the reply Cliff. I will do what you suggested.

It appears that it is time for the StartupManager to become the ApplicationStateManager.

That is the way I am using it at least. But, I like to put round pegs in square holes  :P

Regards,
Derek Basch
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #21 on: April 03, 2008, 11:09:47 »

Derek
Just a few points in response to your above post, relevant if you are doing some work on this.

In the monitor, isLoadingFinished() does not test for complete, it just means this iteration is finished and the app has the option of retry.  allResourcesLoaded() would be appropriate test for completion.

retryLoadResources() does start a process that checks all resources but any that are already loaded are not re-loaded.

Good luck.
    Philip


Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #22 on: April 04, 2008, 01:16:17 »

Derek,

I'm not sure ApplicationStateManager is the right name unless it's implementing the State pattern. Perhaps StartupManager is a misnomer if it's being used throughout runtime to load resources, but State management is a slightly different responsibility. Have a look at the threads on the State Machine Working Group http://forums.puremvc.org/index.php?board=25.0

I may have it wrong here, feel free to correct me with more info.

Cheers,
-=Cliff>
Logged
beavisnz
Newbie
*
Posts: 1


View Profile Email
« Reply #23 on: April 04, 2008, 02:34:52 »

Hi Philip / Cliff

Any chance of getting a retryAttempts function added to return the retry count??
i.e Application mediator can listen for LOADING_FINISHING_INCOMPLETE and retry X times before aborting.

:
/**
* Return number of retry attempts
*/
public function get retryAttempts():uint
{
    return retryCount;
}


Regards
Bevan
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #24 on: April 04, 2008, 03:05:42 »

Bevan
Fair point, we can add to todo list, for action at next opportunity - make retryCount accessible, per your suggestion.  Meanwhile, and in any case, you can maintain your own count in the app class that invokes retry, for example if it is occurring in a single mediator.

This is probably a good point to also mention Derek's comment about offering a controlled method for resetting the StartupMonitorProxy for reuse.
----Philip
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #25 on: April 04, 2008, 04:00:20 »

I agree this should be handled by the utility. It would be nice if a retry policy could be set for each resource, (0, 1, 3, 5..). After the number of allowed retries has been exhausted, a fault would be thrown saying 'max retry attempts has been exceeded, try again' or similar.

-=Cliff>
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #26 on: April 04, 2008, 05:12:27 »

Cliff
Could you just clarify as to whether you mean that the utility would automatically invoke the retries?
----Philip
Logged
trilec
Sr. Member
****
Posts: 52



View Profile WWW Email
« Reply #27 on: April 04, 2008, 06:24:38 »

Perhaps,
ProxyPreloadManager as opposed to  ViewStateManager (the next utility after this one :-) )

On a side note:
Do you think it will make much difference If I adjusted the startupmanager to use multicore so im not loading a single and multi versions into the app or
should startupmanager detect what you use and use that or
two versions with import adjusted or
your crazy Curt, just load the two and sit back down.

for reference:
:
package org.puremvc.as3.utilities.startupmanager.controller {
//import org.puremvc.as3.interfaces.ICommand;  //replace
import org.puremvc.as3.multicore.interfaces.ICommand; //exampe
etc ...

public class StartupResourceLoadedCommand extends SimpleCommand implements ICommand {
T

« Last Edit: April 04, 2008, 07:58:49 by trilec » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #28 on: April 04, 2008, 08:23:59 »

Philip,

It would be nice to allow the utility to automatically invoke the retries. For instance, the demo inserts a button for the user to retry the download, but in a real app, the user shouldn't be forced to do this, nor should they care about what they're retrying the download of. If 3 of 5 downloads need to be retried a couple of times each, this would be annoying if manual intervention is required. So the system would just know how many times each resource can be retried before giving up and do it. Also, you'd want to specify a retry interval; how long to wait between retries.


-=Cliff>
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #29 on: April 04, 2008, 08:29:44 »

Trilec,

At some point (when these latest features are working), it needs to be ported to MultiCore.

-=Cliff>
Logged
Pages: 1 [2] 3 4 ... 7
Print