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

Show Posts

* | |

  Show Posts
Pages: [1] 2 3 ... 10
1  Announcements and General Discussion / General Discussion / Re: PureMVC's future... on: January 09, 2015, 04:47:03
I'm still a user of PureMVC.

Cliff says "But it is solid, works as advertised, and will not be forcing you to change your code because we decided that there was a better way to do things and we'd better throw everything out and start over with a new grand plan."

Exactly, Bravo!


2  Announcements and General Discussion / General Discussion / Re: Advantages of PureMVC over Robotlegs 2 on: December 09, 2013, 07:49:19
... an addition to my previous post

It is interesting to see the size of puremvc in terms of source files and lines of source code.
$ wc -l `find . -name *.as`
     197 ./org/puremvc/as3/multicore/core/Controller.as
     160 ./org/puremvc/as3/multicore/core/Model.as
     293 ./org/puremvc/as3/multicore/core/View.as
      20 ./org/puremvc/as3/multicore/interfaces/ICommand.as
      64 ./org/puremvc/as3/multicore/interfaces/IController.as
     130 ./org/puremvc/as3/multicore/interfaces/IFacade.as
     149 ./org/puremvc/as3/multicore/interfaces/IMediator.as
      56 ./org/puremvc/as3/multicore/interfaces/IModel.as
      75 ./org/puremvc/as3/multicore/interfaces/INotification.as
      56 ./org/puremvc/as3/multicore/interfaces/INotifier.as
      80 ./org/puremvc/as3/multicore/interfaces/IObserver.as
      61 ./org/puremvc/as3/multicore/interfaces/IProxy.as
     105 ./org/puremvc/as3/multicore/interfaces/IView.as
     121 ./org/puremvc/as3/multicore/patterns/command/MacroCommand.as
      41 ./org/puremvc/as3/multicore/patterns/command/SimpleCommand.as
     352 ./org/puremvc/as3/multicore/patterns/facade/Facade.as
     113 ./org/puremvc/as3/multicore/patterns/mediator/Mediator.as
     127 ./org/puremvc/as3/multicore/patterns/observer/Notification.as
      99 ./org/puremvc/as3/multicore/patterns/observer/Notifier.as
     113 ./org/puremvc/as3/multicore/patterns/observer/Observer.as
      86 ./org/puremvc/as3/multicore/patterns/proxy/Proxy.as
    2498 total

I wonder what the corresponding statistic is for robotlegs. Size matters when you want to read and understand the framework code.

3  Announcements and General Discussion / General Discussion / Re: Advantages of PureMVC over Robotlegs 2 on: December 09, 2013, 04:29:22
It's worth noting how stable and unchanging PureMVC is. This probably stems from the simplicity and from Cliff's philosophy to keep it to its core mission.  For a developer, it is a huge advantage to use a framework that does not change (after it has been developed to its required level).

See the github stats (commits, releases etc.) for robotlegs and for puremvc.

4  Announcements and General Discussion / Architecture / Re: Should I share PureMVC sub-classes in a .SWC? on: February 10, 2012, 03:25:14
You need to have a set of classes that, individually, or as a group, are independent of the other more-application-specific classes.  That's obvious you might say. But it's often only when you set out to do it, that you come across dependencies that you hadn't expected.

So, then you might have to refactor the classess - if it makes sense.  This can involve introducing interfaces where there weren't any, and that is often sensible. It can also involve creating higher level classes that are extended at the application level.

In the end, having an swc that contains a set of reusable commands and mediators and proxies can be a good idea, but it is likely to involve some refactoring effort since the classes in question did not start out with that objective. The alternative of duplicate classes is not attractive.
5  PureMVC Manifold / Standard Version / Re: Async Macro Command on: December 23, 2011, 03:46:09
If each task is a retrieval from the remote database, then the Loadup utility might be applicable.  Loadup allows you to specify a set of dependent retrievals and then say 'loadResources' and it takes care of the dependencies.  Each task is a separate proxy instance (whether of different proxy classes or same proxy class), and the proxy (or proxies) must implement the ILoadupProxy interface.

See http://trac.puremvc.org/Utility_AS3_Loadup
6  PureMVC Manifold / Demos and Utils / Re: What is supposed to happen when one of LoadupUtil's proxies fails? on: September 06, 2011, 08:44:47
Two things occur to me.

1. It is absolutely critical that the loaded and failed notifications that you are sending have the correct proxy name in the notification body in each case. Otherwise Loadup will not know that a particular load has completed and will eventually timeout on that load. It would be helpful if you capture the notification body in each case in your debug code.

2. Your mediator should listen for Loadup.LOAD_RESOURCE_TIMED_OUT and capture the content of the notification body and that will show us the resource that is timing out within Loadup, and will confirm the reason for the delay.

Hope this helps. Good luck.
7  PureMVC Manifold / Demos and Utils / Re: What is supposed to happen when one of LoadupUtil's proxies fails? on: September 05, 2011, 03:36:44
Yes, this question should probably be in the Loadup section of the forum.

I am assuming that we are not talking about loading assets via the assetloader sub-system of Loadup.

The LOADING_FINISHED_INCOMPLETE  notification is sent by Loadup when it has completely all attempts to load all the resources that it was asked to load, and one or more of the resources failed to load.  If there are more resources than the 2 that fail, then maybe there's a delay while those other ones are loaded; note that if the set of resources are independent as regards the order of loading, we can't predict the order in which the loads will occur.

Each attempted load has a timeout assigned (currently, default = 300secs). So, the load can effectively fail by timing out, if the load action itself is taking too long, regardless of the ultimate outcome of the load action; remember that Loadup is not the first to know of a load fail or a load success, it is the app itself that knows this first and the app then informs Loadup via notifications that trigger either LoadupResourceLoadedCommand or LoadupResourceLoadedCommand.  On the other hand, it is Loadup that informs the app about a timeout.

If you are getting a LOAD_RESOURCE_TIMED_OUT notification from Loadup, that means that some resource is taking too long to load, be that ultimately a successful load or a failed load.  The fact that Loadup issues the timeout notification does not kill the load action. The load action continues and the final outcome is a matter for the app, as it is with all loads.  At that stage, given the timeout, Loadup doesn't care; it has treated the resource load as a failed load.

If you are getting a LOAD_RESOURCE_TIMED_OUT notification from Loadup, that is probably the reason for the length of time until Loadup issues the LOADING_FINISHED_INCOMPLETE notification (300 secs is a long time). The 'timed out' notification identifies the failed resource in the body of the notification.

I am leaving aside the issue of retries. These would also delay the fiinsh of the loadup process.  You probably have retries =0.

You are probably aware of a lot of what I have stated above, but I hope that something there helps.

On the other hand, if you are saying that
- you send failed notifications and these trigger the relevant commands immediately (i.e. something else in you app doesn't handle these notifications such that the command invocation gets delayed)
- the timed out notification is received at a later time
- then we would need to look at the exact chronology of the notifications to understand what is going on.

8  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: August 04, 2011, 12:14:16
As regards asset1 and asset2 and asset3, let's say the data property of the LoadupHelper class becomes more sophisticated: could be an array of pairs, each pair consisting of [ proxyName, shouldAbort ], or maybe it's just an array of the proxyNames that are to be discarded.  In any case, you then have a way of deciding for each case of asset loadingComplete whether it is one of the ones to discard or not.

As regards "open resource list never sends loadcomplete notifications", I'm not clear what you mean. My understanding is that the attempted load of each asset ends with invocation of one of the event handlers in the asset proxy class, such as loadingComplete. Yes, the loadup instance will not send a loading finished notification (or a loading finished incomplete notification) until all the resources it has been charged with loading have been processed.  It does send the 'waiting for more resources' notification when it has dealt with the list so far.

Hope this helps.
9  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: August 02, 2011, 04:10:26
In relation to your question about asset 1 and asset 2, see the API Docs of the LoadupMonitorProxy class, specifically see the section that begins with The utility can be used to load an open-ended list of resources. In general, each instance of loadup has an associated list of resources to be loaded. When the full list is not known at the beginning, then keepResourceListOpen() can be used and addResource() can be used, as the need arises, to add a resource to the list.  Please see the API Docs for the full story. So, you could adopt that approach and use the one loadup instance for the ongoing set of resources.

Continuing with this open-ended list feature, in your case, you have an asset group proxy.  So, as each new resource to be loaded becomes known, I suppose you add it to the asset group proxy using addAssetProxy(), in addition to adding it to the loadup resource list using addResource(). I dont have experience of adding assets to the asset group in this open-ended manner, but it seems like it should be ok.

Your mention of Loader.close() is interesting. Loadup has no feature to take advantage of this; it was not anticipated as a requirement. It looks like something worth investigating. There is is the possibility of you using it directly, outside of loadup.  If you have your own sub-class of AssetProxy, as suggested in my previous post, then you have access to the loader variable.  With this, you yourself could directly invoke loader.close(), having cast loader to the appropriate type.  I dont know what event(s) this gives rise to, but the loadup instance would be depending on some expected event (e.g. IO_ERROR) in order to know the status of the resource load.  Maybe youve already tried loader.close()?

Edit: My point above about loadup depending on an event from loader.close() might be irrelevant.  After you invoke loader.close(), you could send an ASSET_LOAD_FAILED notification and that informs loadup that the resource load is to be treated as failed.

Hope this helps.
10  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: July 18, 2011, 09:24:21

My suggestions as follows.
1. To make the code more readable, you could create an explicit LoadupHelper class and include a property, with a name such as shouldAbort, implemented as a get method e.g. function get shouldAbort() :Boolean.  This function can access and interpret the proxy's data property.  Thus the usage of the data property is kept local to LoadupHelper and can evolve over time.  There would likewise be a function set shouldAbort(...) :void.

2. In the loadingComplete function of AssetProxy, when shouldAbort is true, I would be inclined to not set loaded and assetData etc., since we want to discard anything loaded and behave as though the load failed.

3. Instead of directly modifying AssetProxy, you could extend it with your own class and override the loadingComplete method.  In addition, that class could have another method, named say loadingBehaveAsFailed
- invoked from loadingComplete when shouldAbort is true
- content same as loadingSecurityError, without the ASSET_LOAD_FAILED_SECURITY line
- thus it uses a FailureInfo object, to inform Loadup not to retry.

 Hope this helps.
11  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: July 07, 2011, 09:01:29
Here is an approach. There may be other and better approaches. It does not involve the mediator.

Let there be a Loadup instance called lux, with name luxName.  Let there be a new proxy, of type Proxy, with name luxHelper, where luxHelper is easily derived from luxName.  luxName and luxHelper are Strings or course.  For example, luxHelper = luxName + "Helper".

If the event occurs that means we would like to abort the loadup process
- create and register the luxHelper proxy:  = new Proxy( luxHelper, new Boolean(true) );
- so, the data property of the proxy is a Boolean.

For each ILoadupProxy proxy that is interacting with lux, assume there is a 'loaded' method and a 'failed' method, invoked within the app. In the loaded method, we have
if ( facade.hasProxy( luxHelper ) {
    retrieve the helper proxy
    if the helper proxy data is true, invoke the 'failed' method and quit the loaded method
    else carry on with the loaded method

I have avoided making a new class for the helper proxy, but it could be better to have one. Also, the helper proxy could be created and registered at the outset, witrh data set to false.

I hope this makes sense and that it helps.
12  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: June 10, 2010, 10:18:17

The answer is No, I suppose.  But let me contribute the following thoughts
  • the difficulty is that the resource loads are typically requested as asynchronous services to be executed on a remote server, so once requested, it is hard to influence them
  • if you have dependencies within the set of resources to be loaded, then if a load fails, the dependent loads will not commence
  • if, after starting the load via the loadResources() call, you decide that you no longer want the resources, you could simply discard the response messages as they return to you, and send a 'load failed' notification for each such response, including a 'do not retry' instruction; the objective of such failed notifications is to move loadup to the 'finished incomplete' state as soon as possible.

Hope this helps.
13  Announcements and General Discussion / General Discussion / Re: PureMVC TV on: April 16, 2010, 02:52:48
On a point of information - maybe you know already, maybe you don't: in the PureMVC Actionscript world, the StartupManager utility has evolved into the Loadup utility
14  PureMVC Manifold / Demos and Utils / Re: PureMVC Loadup Util giving fluctuating progress percentage on: March 10, 2010, 04:37:50
For a group of assets, to be loaded via the asset loader facility, Loadup prefers to calculate the percent loaded on the basis of bytes loaded versus the total to be loaded, as opposed to a simple number of assets loaded versus the total number of assets.  It relies on the information provided by the ProgressEvents that occur within the load process for each asset.  However, the bytes total (total size) for an asset can only be known when loading of that asset has commenced.

The loading occurs asynchronously; several assets can be undergoing load simultaneously.  However, until all of the loads have commenced, the overall total bytes is not known, and hence progress on the exact bytes basis cannot be reported.  So, until that point has been reached, the percentage is calculated on the basis of  the percent loaded per asset, averaged across the total number of assets.  For example, assets A,B,C,D.  A is 75% loaded, B is 25% loaded, C and D not started.  The reported progress percentage is (75+25)/4 = 25%.  Then, when C and D have started, the reported percentage is based on the exact bytes.  Now, if C and D turn out to be large relative to A and B, a drop in the reported percentage will be observed.

If a progress percentage, based on number of assets loaded versus the total number of assets, is preferred, use the Loadup.LOADING_PROGRESS notification instead of the Loadup.ASSET_GROUP_PROGRESS notification.

Hope this helps.
15  Announcements and General Discussion / Architecture / Re: Suggestion to "as YXZProxy" casting on: March 03, 2010, 03:52:53
Useful reference on this topic:
Pages: [1] 2 3 ... 10