PureMVC Architects Lounge

Announcements and General Discussion => Public Demos, Tools and Applications => Topic started by: PieterGrobler on November 12, 2008, 04:01:17



Title: PGProxyReservation
Post by: PieterGrobler on November 12, 2008, 04:01:17
(http://www.pietergrobler.com/utilities/PGPR.jpg)

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.


Title: Re: PGProxyReservation
Post by: Jason MacDonald 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?


Title: Re: PGProxyReservation
Post by: PieterGrobler 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.


Title: Re: PGProxyReservation
Post by: puremvc 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>


Title: Re: PGProxyReservation (proxy memory management)
Post by: PieterGrobler 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?


Title: Re: PGProxyReservation
Post by: Joel Hooks 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.


Title: Re: PGProxyReservation
Post by: PieterGrobler 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?


Title: Re: PGProxyReservation
Post by: Joel Hooks 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.