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: How to call some remote Proxies at startup  (Read 6776 times)
Buakaw
Newbie
*
Posts: 4


View Profile Email
« 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?
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #1 on: July 03, 2008, 05:27:00 »

Have you considered whether the StartupManager utility could be useful for this?

As regards your solution options, I prefer A.
----Philip
Logged
Buakaw
Newbie
*
Posts: 4


View Profile Email
« Reply #2 on: July 03, 2008, 02:31:21 »

Thanks Philip for your response. Yes I will look into the StartupManager utility.
Logged
Pages: [1]
Print