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 / Re: PureMVC's future... on: January 09, 2015, 05:35:59
The main reason I decided to go with PureMVC many years ago was exactly what you describe, Cliff, I was fed up with staying up to date with all the new frameworks popping up when in the end they are not better, only different. I guess it also has to do with age, if you have been coding for some years and had the "pleasure" of refactoring your own old code bases, you get to like the value of something stable like PureMVC.
And what simply no other framework can offer is the fact that you can port the architecture to another language painlessly, which helped me tremendously!

I really like the forums here, I believe it would not need much to improve the website itself, maybe just keep the frontpage a little bit more up to date... ;-)
2  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?
 
3  Announcements and General Discussion / Architecture / Re: Asynchronious Loading on: January 27, 2014, 12:13:08
Hi saad

Good point. :-) But when you do it that way you have to go through all the proxies to know what is loaded and in what order. In the PrepareModelCommand it's all neatly togehter in one place, it's easy to change if needed. And, I kind of don't like the idea of a proxy having to know about the loading of another proxy. I think the less it knows about the application the better. I guess it's the commands job to handle such logic.
4  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):

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

PrepareModelCommand:
:
@Override
    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);
                imagesProxy.loadImages();
                // ... 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);
                soundProxy.getData().playStart();
                // PrepareModelCommand is not needed anymore, so let's get rid of it:
                getFacade().removeCommand(AppConstants.PREPARE_MODEL);
                // Model is ready, move on to the view!
                sendNotification(AppConstants.PREPARE_VIEW);
            }
        }
    }

ConfigProxy:
:
@Override
    public void onRegister() throws IOException, ClassNotFoundException {
        // Do something....
        if (getData().getImagePath().isEmpty()) {
            getData().setImagePath(AppConstants.IMAGE_PATH);
        }
        // ...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?

 

5  Announcements and General Discussion / General Discussion / Re: Advantages of PureMVC over Robotlegs 2 on: January 27, 2014, 12:03:31
For me, portability is the strongest reason. When I evaluated frameworks in 2011, I was almost going with Robotlegs. But I finally decided to take PureMVC because if it's portability. Back then I was developing in Actionscript only. But by now I've built websites using PureMVC for PHP, and also JavaScript. I've just finished my first app in Java, and I have to say that in all those languages I immediatly felt at home with PureMVC. It is just a rock solid microframework that never stands in your way and I'm looking forward to try it with Haxe, Typoscript and even Python. :-)
6  Announcements and General Discussion / Architecture / Re: Inter-core communication by implementing sendMessage() method in Facade.as on: November 02, 2013, 01:00:11
Hi!

I have been using pipes for this also, but one day I had to create inter-communication between our PureMVC app and a module which was built without pureMVC. That's when I started to think about how to achieve this in a clean way, and I finally created a utility called "pigeons". Now I also use it in every situation, even between two pureMVC apps instead of pipes. The cool thing is, it has the same structure as a notification in PureMVC, a name, a body and a type. It's called pigeons, because I like to think about sending message pigeons from one module to another. Have a look and let me know what you think: http://blog.kaegi.net/pigeons-utility-as3-intercommunication-between-shell-and-modules/

And I guess it could be easily ported to other languages as well... :-)

Best,
Christian
7  Announcements and General Discussion / Getting Started / little demo app in 2 flavours on: June 25, 2012, 01:30:55
Hi!

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! :-)
http://blog.turtlebite.com/puremvc-performance-test-compared-to-using-no-framework/

Cheers,
Christian
Pages: [1]