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]
Print
Author Topic: PGProxyReservation  (Read 11668 times)
PieterGrobler
Newbie
*
Posts: 8


View Profile Email
« on: November 12, 2008, 04:01:17 »



I created a utility for the PureMVC framework called PGProxyReservation. In short:

The PGProxyReservation utility is used to effectively flush proxies from their data when not in use. Whenever a view or another proxy requires the use of a proxy, it reserves it, and releases it when it's done. The utility automatically gets the proxy in an initialised state, as long as it implements IReservable. When no reservation is left for a particular proxy, the utility clears its data object. This is a huge advantage for applications that are heavily data reliant. It keeps your application leight-weight, keeping initialised only those proxies that are currently in use.

Attachment too big: You can download it at: http://blog.pietergrobler.com/node/4

Hope this is helpful. Drop me a line with questions or feedback. Thanks, Pieter Grobler.
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #1 on: November 12, 2008, 07:18:23 »

Sounds interesting, though I'm can't think of a particular use case for it. Most of my apps use their proxies pretty consistently, and those that are a one-time use I tend to clean up myself once their task is complete.

Could you give an example of a use case where this utility would help so myself and others can get a better idea of it's place within a PMVC app?
Logged
PieterGrobler
Newbie
*
Posts: 8


View Profile Email
« Reply #2 on: November 12, 2008, 08:32:33 »

Um... let's see. I'm working on an application which accesses about 45 different external db tables with separate proxies. The amount is still growing. Both mediators and other proxies use this at various times. In effect, if one view (mediator) cleaned up the proxy, another one might still be using it, and might find itself pointing to a null data object. With this utility, usage of the proxy is managed, keeping reference to clients using the proxy, and then clears it up if there is no 'reservation' on the proxy. Hope this makes sense.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: November 12, 2008, 07:23:07 »

Potentially a very useful utility. I'll inspect the code a little closer but a quick review shows it to be a pretty simple and well documented solution to the problem Pieter described.

Good work, Pieter!

-=Cliff>
Logged
PieterGrobler
Newbie
*
Posts: 8


View Profile Email
« Reply #4 on: December 10, 2008, 06:15:25 »

Just dropping in again to find out if anyone has found this useful yet? I've some ideas to modify and extend it. Any feedback at all? Anyone tried it out yet?
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #5 on: January 09, 2009, 04:02:15 »

I went ahead and changed the code for my use to use the passed id string as the name of the proxy as I use a lot of dynamically named proxies in my system. After that it seems to be working great. I'd probably like to have an abstract class to implement that took care of the IEventDispatcher, ready, and clear bits (with getBulkData() in the concrete class) - since they are all generic anyway.

I have a rather data intensive application that I am currently optimizing, so it will be cool to see how it all works out. I will report back :>

Cheers.
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
PieterGrobler
Newbie
*
Posts: 8


View Profile Email
« Reply #6 on: January 12, 2009, 06:43:00 »

Sounds great Joel, and thanks for the feedback. That's in line with what I had in mind changing. Maybe we could compare results when you're ready?
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #7 on: February 02, 2009, 02:52:59 »

After using it, the only gripe I have is that you can't pass in identifiers for proxies outside of the proxy name. Once I added in an instance name parameter, it works great.
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
Pages: [1]
Print