PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: dmurat on June 04, 2008, 03:07:39



Title: Notifier extensibility
Post by: dmurat on June 04, 2008, 03:07:39
I was wondering if Notifier class can be redefined a little. Currently, it has "facade" member initialized with "Facade.getInstance()". If one wants to use different IFacade implementation in Notifier subclasses, it is impossible. Therefore, if I may suggest, I believe Notifier can be made more extensible by using setter and getter (or just getter) instead of instance variable. Then, it will become possible to override it in subclasses.

I think this is already implemented that way in multicore version.

Best regards,
Damir Murat


Title: Re: Notifier extensibility
Post by: puremvc on June 04, 2008, 03:18:32
It is reimplemented in MultiCore, but at the expense of having to wait until initializeNotifier before any facade related activity can happen. It had to be done that way in MultiCore because there is more than one Facade instance, and you don't know the multiton instance to ask for until the multiton key is set.

The Facade.getInstance() call in the Notifier class does not get an instance of Facade, it gets whatever IFacade implementor that extends Facade that you have created. The assumption is that you have already initialized your ApplicationFacade by the time you are creating your Notifiers.

-=Cliff>


Title: Re: Notifier extensibility
Post by: dmurat on June 04, 2008, 04:26:07
Tnx for such quick reply.

Well, the problem is that I will like to use method with different signature and from class which doesn't extends Facade, but rather just implement IFacade. On the other hand, I will like to use Notifier implementation. Heh, I guess I'm a little bit demanding :-)

But never mind, It is not so big issue for me. I was just thinking that introduction of getter will easily solve my needs without breaking anything.

Best regards,
Damir Murat


Title: Re: Notifier extensibility
Post by: puremvc on June 04, 2008, 10:26:13
It's tempting to add getters a getter or some such to the facade, but then it could quickly become the trash heap of your app. That's one of the reasons people rail against the use of Singletons, because of the kind of fallout that comes from 'Global' thinking.

What kind of getter were you wanting to put on there? It could probably be better placed elsewhere.

-=Cliff>