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

Show Posts

| * |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / General Discussion / PureMVC's future... on: January 08, 2015, 02:53:22
Hi all

I'm using PureMVC on a daily basis for projects in PHP, JAVA, AS3 and Javascript. I just love it for the fact that I can reuse my knowledge in all these languages. But more and more I'm having a really hard time convincing others that PureMVC is great. When they check the website here, it looks like it's slowly vanishing... The latest news is more than 2 years old... :-( It would be so nice to see that the PureMVC framework is still alive and kicking. Why don't I see news like the Swift port (https://github.com/mittenimraum/puremvc-swift-standard-framework) on the frontpage? Does anyone have the time to redesign this puremvc.org website and let it shine again? Or do I have to face the fact that it is not supported any longer? Maybe I'm the only one using it these days??

What's your opinion?
2  Announcements and General Discussion / Architecture / Asynchronious Loading on: January 27, 2014, 12:32:55
Hi all

I know there's Async Commands, but I use to do asynchronious loading in a really simple way, and it works perfectly (I'm using it in ActionScript and Java projects). Because it is so easy, I would like to know what you think of it. :-)

PrepareModelCommand is called when PREPARE_MODEL notification is sent. In it, a proxy is registered and the command dies. We have to wait for this proxy to finish it's setup (maybe it loads from a database or whatever). When it is ready, it sends a PROXY_INITIALIZED notification. This is again mapped to PrepareModelCommand, which checks who called it (I use "type" of the notification for this), and then the next proxy is registered and so on. If no async loading is needed, I may register some proxies at the same time, whatever the situation demands. In the end, the PREPARE_VIEW notification is sent, and in the PrepareViewCommand, the same procedure starts again.

In code it looks somehow like this (Java):

registerCommand(AppConstants.PREPARE_MODEL, new PrepareModelCommand());
registerCommand(AppConstants.PROXY_INITIALIZED, new PrepareModelCommand());
registerCommand(AppConstants.PREPARE_VIEW, new PrepareViewCommand());
registerCommand(AppConstants.MEDIATOR_INITIALIZED, new PrepareViewCommand());

    public void execute(final INotification note) throws IOException, ClassNotFoundException {
        if (note.getName() == AppConstants.PREPARE_MODEL) {
            getFacade().registerProxy(new AnswerProxy(new AnswerData()));
            getFacade().registerProxy(new AppProxy(new AppData((Stage) note.getBody())));
        } else {
            if (note.getType() == AppProxy.NAME) {
                // AppProxy is ready. Do something...
                final AppData appData = (AppData) getFacade().retrieveProxy(AppProxy.NAME).getData();
                final double w = (appData.getAppWidth() - 200) / 6;
                configData.setImageSize((int) w);
                // ... and register the next proxy.
                getFacade().registerProxy(new ConfigProxy(configData));
            } else if (note.getType() == ConfigProxy.NAME) {
                // ConfigProxy is ready... load the next Proxy.
                getFacade().registerProxy(new HighScoreProxy(highScoreData));
            } else if (note.getType() == HighScoreProxy.NAME) {
                // HighScoreProxy is ready... register UserProxy (we don't have to wait for this one)
                getFacade().registerProxy(new UserProxy(new UserData()));
                configData = (ConfigData) getFacade().retrieveProxy(ConfigProxy.NAME).getData();
                // ...and register ImagesProxy
                getFacade().registerProxy(new ImagesProxy(configData, new ImagesData(AppConstants.IMAGE_BACKSIDE_PATH)));
            } else if (note.getType() == ImagesProxy.NAME) {
                // ImagesProxy is ready, load the images (get's them from a directory, so we need to wait for it)
                final ImagesProxy imagesProxy = (ImagesProxy) getFacade().retrieveProxy(ImagesProxy.NAME);
                // ... but we can already register the StateProxy.
                getFacade().registerProxy(new StateProxy(new StateData()));
            } else if (note.getType() == StateProxy.NAME) {
                // StateProxy is ready, load the next one...
                getFacade().registerProxy(new SoundProxy(new SoundData(configData.getSoundEnabled())));
            } else if (note.getType() == SoundProxy.NAME) {
                // SoundProxy is ready, load the final one, and because we don't have to wait for this,
                // the model is ready and the View can start it's initialisation
                final SoundProxy soundProxy = (SoundProxy) getFacade().retrieveProxy(SoundProxy.NAME);
                // PrepareModelCommand is not needed anymore, so let's get rid of it:
                // Model is ready, move on to the view!

    public void onRegister() throws IOException, ClassNotFoundException {
        // Do something....
        if (getData().getImagePath().isEmpty()) {
        // ...when you think this proxy is ready, send the notification so the next proxy is registered.
        sendNotification(AppConstants.PROXY_INITIALIZED, null, NAME);

So, the simple idea is that the PrepareModelCommand (and PrepareViewCommad) is called more than once, each time another Proxy requested it. The command does it's job and dies. So we don't misuse a command and let it wait for a response. When a proxy is ready, it just calls the command again, it does the next piece of code and dies again.

What do you think about this procedure?


3  Announcements and General Discussion / Getting Started / little demo app in 2 flavours on: June 25, 2012, 01:30:55

After a heating discussion about PureMVC and performance I decided to create a little test application: one app is using a single monolithic class, the other, identical app is using PureMVC. Maybe there are others who like to have the source code to compare? Feel free to do so! :-)

Pages: [1]