PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: Flapflap on December 10, 2007, 09:56:35



Title: Meditor, handle of notification without switch statement...
Post by: Flapflap on December 10, 2007, 09:56:35
Hi there,
I'm not a big fan of having a switch in handleNotification method.
Switch can be very big if you handle a lot of notification.

I used a Map class instance that associated each notification name to an handler method (very close to eventBroadcater with delegate). So you can define to each notification your handle the specific method of your mediator.

If it interrest some people I can provide the map class (taken from LowRA framework but without any dependencies) and my own sub-mediator class...


Title: Re: Meditor, handle of notification without switch statement...
Post by: Flapflap on December 13, 2007, 03:11:15
Sorry don't see it...

Maybe you talk about my blog post (in french sorry) here :
http://kilooctet.net/index.php/2007/12/11/68-puremvc-le-komediator-un-mediator-un-petit-peu-plus-souple-selon-moi

and the 2 files : Map and KoMediator :
http://www.zshare.net/download/55377985f8ab57/

???


Title: Re: Meditor, handle of notification without switch statement...
Post by: Peter on December 28, 2007, 12:39:38
I don't think so. If you let a Mediator govern just one ViewComponent, the switch won't have to handle that much notifications. I'm building a fairly large application and I didn't have to use more than 5 notifications per Mediator max. Performance is great untill now so nothing to complain there either. So I guess it's just a matter of taste then.


Title: Re: Meditor, handle of notification without switch statement...
Post by: justsee on January 02, 2008, 04:36:39
If anyone's interested, this topic has also been covered indepth here: http://forums.puremvc.org/index.php?topic=22.0