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 / Public Demos, Tools and Applications / Re: PureMVC Metatags helper for Mediators on: January 06, 2009, 12:48:54
Hi Cliff,

Thanks for your comments. I didn't see your arguments when thinking about this trick. I agree that the switch statement in the handleNotification() method is planned simplicity, it really is. It is just boring :) Another good point to the switch is that I usually use this place to cast the generic notification.getBody() object into the type expected by the handler, and make type verification as well. I think it's a good place to but this kind of repetitive code with little business value.

Regarding the "technology-proofing" principle of PureMVC, I understand it and agree as well. You're right that it is preferable to make it easy to change the technology easily, they are moving so fast.

So finally, maybe this trick could be useful for small, personal software when you want to make PureMVC use a little easier with Mediators -- and using Flex of course :)

Thanks again for your comments, they are enlightning :)

Avangel.
2  Announcements and General Discussion / Public Demos, Tools and Applications / Re: PureMVC Metatags helper for Mediators on: January 05, 2009, 09:50:40
Sorry, the source view seems to be badly generated.

Please find the source Zip attached to this post.
3  Announcements and General Discussion / Public Demos, Tools and Applications / PureMVC Metatags helper for Mediators on: January 05, 2009, 09:35:42
Hi,

PureMVC is a great framework for developing RIAs. But sometimes it can require some repetitive and "useless" code from business point of view.

In my opinion, the biggest flaw is with the mediator, its listNotificationInterest() and handleNotification() methods that are the same for all mediators. Especially handleNotification(), which must contain a dumb switch/case testing all notification names and map them to private handlers.

So I wrote a little mediator adapter, called "MetadataMediator" that you should extend instead of regular PureMVC mediator. It enables you to remove those functions from your mediator and replace them with custom metatags declared at the top of your class:

[ListenTo(name=NotificationName,handler=HandlingFunction)]

And that's all :)

But it has some drawbacks too, please see the MetadataMediator source code in the following demo:
http://prog.13.free.fr/metatags_demo/TestMetaData.html (right click -> Source code).

Your comments are welcome !

Avangel.
Pages: [1]