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
PureMVC Architects Lounge
Announcements and General Discussion
Architecture
check if object registered
Pages: [
1
]
« previous
next »
Author
Topic: check if object registered (Read 6178 times)
nilsm
Jr. Member
Posts: 19
check if object registered
«
on:
January 25, 2008, 05:18:55 »
Hi all,
I'm quite often faced with having to check whether a proxy of a particular type has already been registered.
For example, different parts of the application can embed a shopping module, which initialises its own proxies. If the proxies already exist in the Facade, I don't re-create them.
At the moment I've added methods to my Facade implementation:
hasProxy(name:String):Boolean
hasMediator(name:String):Boolean
but that requires casting the 'facade' property, so it creates an unwanted dependency in the commands.
Is there a chance that such methods could be added to future iterations of the framework?
Maybe there is also a more efficient way to implement as a native part of the framework rather than attempting to retrieve the object and checking whether the result is null.
Does anybody have any thoughts or other suggestions?
cheers - Nils.
Logged
puremvc
Global Moderator
Hero Member
Posts: 2871
Re: check if object registered
«
Reply #1 on:
January 25, 2008, 06:49:50 »
What is wrong with casting the Facade in your Command?
It seems reasonable enough, to add to the framework, though. I will consider it.
-=Cliff>
Logged
nilsm
Jr. Member
Posts: 19
Re: check if object registered
«
Reply #2 on:
January 25, 2008, 08:03:06 »
I guess there's nothing 'wrong' with it - it just means that the command becomes dependent on a particular Facade implementation. I really like the use of interfaces in PureMVC and would prefer not to have to break them here.
cheers - Nils.
Logged
puremvc
Global Moderator
Hero Member
Posts: 2871
Re: check if object registered
«
Reply #3 on:
January 29, 2008, 11:24:59 »
Nils,
I'm naturally resistant to suggestions for change, since the goal is to push this thing to a stable point and let it rest. But in this case, you're absolutely right - these methods should be a part of the framework.
I've added
hasProxy
,
hasMediator
and
hasCommand
methods to the Model, View and Controller respectively. The Facade, of course gets all three methods. All the interfaces have been updated, and it is now in 2.0 and the corresponding new unit tests all pass.
-=Cliff>
«
Last Edit: January 29, 2008, 11:26:53 by puremvc
»
Logged
nilsm
Jr. Member
Posts: 19
Re: check if object registered
«
Reply #4 on:
January 30, 2008, 02:59:50 »
Much appreciated - thanks!
- Nils.
Logged
Pages: [
1
]
« previous
next »
Stack Overflow
GitHub
Linked In
Google Plus
Twitter
Powered by SMF 2.0.15
|
SMF © 2006-2007, Simple Machines LLC
|
Content © 2006-2018, Futurescale, Inc.
Loading...