PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: letapjar on February 20, 2011, 08:46:17



Title: code gremlin? listNotificationinterests accepts same note more than once.
Post by: letapjar on February 20, 2011, 08:46:17
Just spent 2 hours chasing down a code gremlin.

I had a mediator that had a long list of notifications it needed to respond to.

Somehow a couple of notifications were entered twice in the list notification interests array.

This resulted in handle notification being called twice for the notes that were listed twice.

Is this by design?

Seems to me that there should be some check in the register mediator process that makes sure a mediator only listens to a note once since all notes are processed by the same handleNotification method.

Is there actually a use case for having the handleNotification method fired twice in the same mediator for the same note?

(oh btw this was the AS3 multi-core version).


Title: Re: code gremlin? listNotificationinterests accepts same note more than once.
Post by: puremvc on February 20, 2011, 12:31:48
No use case for doubled note names exists.

But after weighing the extra code and aggregate cycles that would be spent ensuring that there are no duplicates in mediator notification lists when 99.999999% of the time their won't be, I'm inclined to simply point out that Garbage In/Garbage Out applies: If you register twice, you're going to be notified twice.

-=Cliff>