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]
1  Announcements and General Discussion / Fabrication / A big "gotcha" to watch for with dynamic Proxies extending FabricationProxy on: June 10, 2009, 08:59:50
When using Fabrication with dynamically generated Proxies, there's a big gotcha to be aware of. I just spent hours debugging this problem so I thought I'd share my findings and save others the hassle.

When using dynamically named proxies, Fabrication will alter any outgoing notification names from that proxy. For instance, if you have a proxy named DataProxy_563 and you send a notification from within the Proxy called DataComplete, Fabrication will alter the outgoing notification name to DataProxy_563/DataComplete. This is done, in conjuction with a second notification sent named NOTIFICATION_FROM_PROXY, so that you can have mediators listen for specifically named proxys using a respondToDataProxy_563(note). The problem, however, is that this alteration requires your mediator to know ahead of time that the proxy they are interested in is named DataProxy_563, which you can't do when naming proxys using a dynamic generated name like _563. You lose the simple DataComplete notification altogether and can only listen for "DataProxy_563/DataComplete" (which won't work as a respondTo name) so you have to use the respondToDataProxy_563(note) method.

In my case I wanted to listen for that basic DataComplete notification and then inside the respodToDataComplete() call figure out what Instance of DataProxy it came from and go about my business that way.

Luckly, Darshen was smart (like you didn't know) and include a little mysterious property called expansion which, when set to false, will completely bypass the renaming and send the normal notification. YAY!

My only complaint is that I would have rathered this been set to false by default, rather than true. I don't really see many instances where I would want that default behavoir.

Anyway, simply set this to false in your proxy, assuming of course that you are entending FabricationProxy, to have the normal notification behavoir.
2  Announcements and General Discussion / General Discussion / Flex Code Formatter on: June 05, 2009, 08:52:37
It always drove me nuts that I couldn't control the default way Flex formats it's code. I've always coded by putting bracers on the same line as the method, class etc. I decided to do some searching and found this[1] eclipse plugin. I don't know how I survived before without it! It works perfectly and is highly configurable. Just thought I'd make a mention of it incase others have the same problem as I did.

[1] http://sourceforge.net/project/platformdownload.php?group_id=248408
3  Announcements and General Discussion / Fabrication / Another small request on: January 29, 2009, 08:27:30
I started using interceptors today, and they rock. However, I found one small change I needed to make in order to inject an interceptor (or any code) before the application starts, but after the fabrication apparatus was initialized completely. I need to ensure access to moduleAddress but also to make sure no notifications or routing have been sent out yet.

I found that inside startApplication() of ApplicationFabricator there's a notifyFabricationCreated() method called on the FlashApplication class which I could override in my own ModuleApplication allowing me to run my code before the app started. I thought it was perfect for injecting my code, however, I realized this call is made after _facade.startup(startupCommand, fabrication) resulting in my code running after some of the initial routing, notification and other start-up calls are made. By reversing the order of these two calls within StartApplication() I was able to register my code before the application actually started, but still ensuring that fabrication was intialized and moduleAddress was available.

Can you see any reason not to reverse these calls? Am I missing anything that may misfire? Is there a better way to run some of my own code after fabrication has initialized but before the startup command is called?

I realize I could just add my code to the start-up command itself, but I wanted to add it in my base module class so all my modules could inherit the functionality.
4  Announcements and General Discussion / Fabrication / Something amiss with 0.6 (Flash fails to compile) on: January 26, 2009, 08:52:29
I finally got around to testing out 0.6 today and it fails to compile under Flash cs4. The weird part is it compiles under CS3. As soon as I switch the source from 0.5.2 to 0.6 I get the following compile errors in CS4. I'm not positive, but I think it may have something to do with the internal classes, as those are the major difference between .5 and .6 in the FabricationController class.

:
FabricationController.as, Line 123   1020: Method marked override must override another method.
FabricationController.as, Line 131   1020: Method marked override must override another method.
FabricationController.as, Line 145   1020: Method marked override must override another method.

I've tried to find the problem all morning but to no avail. As I mentioned, it does compile under CS3. And switching back to 0.5 I can compile fine under CS4.
5  Announcements and General Discussion / Fabrication / Module Groups on: December 08, 2008, 08:34:23
Hey Darshan,

I was wondering if you had any feedback on module groups. I find myself needing to send routing messages to a group of modules (group A) while having another group ignore the message (group B) where both group A and Group B have listeners for the same message type. I'm wondering what the best approach here might be.

To try and give an example, I have 2 views: View one is made up of 3 modules that need to respond to notifications from other modules within their group [view]; View 2 also has 3 modules that need to perform similar tasks as View 1.  View 1 & 2 are made up of the same modules, loaded with different instance names (module0 vs module1), that perform the same tasks but need to respond only to their internal groups notifications. While a solution for only two views might be to use some naming convention but the problem I face is I may have any number of views using the same modules just new instances, so using a name based approach becomes difficult.

My first thought was to add another parameter to routeNotification called group, where the loading view module could assign a group name to all child modules allowing a new discriminator in my listeners to check the group name against it's own. But obviously this would require changing Fabrication making future upgrades a pain. I can't just use the "type" field as I have many situations where that field is already providing a required piece of data for something.

Originally I thought this might have been what the firewall was for, but it seems (from my limited knowledge) that the firewall is based on stopping the message from ever going out, rather than filtering who the message should go out to.

Just wondering if I'm overlooking something already in place in Fabrication or if I need to bake up some homegrown solution?
6  Announcements and General Discussion / General Discussion / Anyone going to MAX in SanFran? on: October 25, 2008, 08:07:38
I finally convinced my company after two years of begging to send me to MAX, I can't wait. Just wondering if any other PMVC'ers re going. Cliff? I saw you are going to <head>, are you speaking at MAX?
7  PureMVC Manifold / MultiCore Version / Pipes Best Practice Question for Module-to-Module Communications on: October 08, 2008, 12:32:53
So I've been building a rather large application using Multi-core and pipes (Pure As3, no FLex) and so far have most of the basics working (shell-> module communications, dynamic modules loading etc).

The problem I'm trying to wrap my head around is when you have a DATA module, containing most of the Model/Domain logic for the whole app, that needs to communicate with the Shell's dynamically loaded modules either one-to-one or broadcast to multiple.

I get that I can have the Shell lay down pipes between the data module and all the loaded modules, or have all the modules query up through the Shell to the Data module and then have the data flow back in the reverse order. The issue I can't figure out how to solve is when a module needs a piece of data (value objects in my case) from the Data module but that vo needs to come back to the originating module requesting it only, and not across a broadcast data pipe. This alone wouldn't be too hard I suppose, but I have the flip side where a module requests that same piece of data only this time multiple modules need to react to the returned data. Essentially I need a way to direct traffic of data without having the modules know of each other. Some kind of switch that says "hey, send this data only to me, or send it back to everyone interested". How could you accomplish this without having the Data module knowing the existence of all the modules it's connected to? I can't see how the Data Module could send a message back to only the originator without the message contaning some kind of identifier of the originator.

I'm sure this is probably somehow related to the filter messages but I haven't been able to figure out how they work yet.

My first thought was to send the modules unique ID in the message header if it should come back to it alone (thus being able to check the header of a broadcast response for it's own key), or send the request without a key it if it doesn't care who gets the data back. But that means the Data Module would need to carry around that key somehow from the time the initial request comes through its in-pipe until the time the response message is sent. And this seems rather sloppy somehow especially if it's trying to handle multiple requests at once. Things like, where would you store such a key while the commands do their thing to gather the data needed from the proxies. And how would you map that key so when the data was ready you knew what to do with it. It just starts making my head spinning trying to manage all that. There must be a simpler way.

I hope the above explanation makes sense, my brain is a bit fried right now.
Pages: [1]