Buakaw
|
|
« on: July 03, 2008, 02:04:38 » |
|
Hi!
I want to realize an application which is loading some data at startup. For this purpose there are some remote proxies which shall be called in succession (e.g. ConfigLoaderProxy, ClassLoaderProxy, FontLoaderProxy).
Question is: Which is the smartest solution for that issue?
A) One Command
Creating a "StartupCommand" which is registered under several notification names and reacts to them via a switch block: If the name is "Startup" the command will call the first remote proxy's load method. When data is loaded the first remote proxy will send the notification "ConfigLoaded". Now the StartupCommand will call the second proxy's load method and so on ...
Pro:
- only one responsibility (one command)
Con:
- has to be registered under several notification names
B) One Mediator
As described in A), but instead of a command a mediator is doing the job.
Pro:
- only one responsibility (one mediator) - does not has to be registered under several notification names
Con:
- actually its not really the job of a mediator because there is no view to mediate for.
C) Multiple Commands
There might be following commands: LoadConfigCommand, LoadClassesCommand, LoadFontsCommand - one command for each remote proxy.
Pro:
--
Con:
- multiple responsibilities (code is not centralized) - Too much overhead: The commands only include one line of code within their execute method
What's your oppinion?
|