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: Meditor, handle of notification without switch statement...  (Read 7497 times)
Flapflap
Courseware Beta
Newbie
***
Posts: 4


View Profile Email
« 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...
Logged
Flapflap
Courseware Beta
Newbie
***
Posts: 4


View Profile Email
« Reply #1 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/

???
Logged
Peter
Full Member
***
Posts: 26


View Profile Email
« Reply #2 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.
Logged
justsee
Courseware Beta
Newbie
***
Posts: 9


View Profile Email
« Reply #3 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
Logged
Pages: [1]
Print