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 / How to make notify system singleton less? on: February 08, 2008, 04:54:10
Hi guys,
I'm trying to extend the framework so that you can choose to not use singletons.
http://forums.puremvc.org/index.php?topic=235.0

Changing the concrete Facade, Model, View and Controller is no problem, but the Notifying system worries me.
Because a lot of classes (MacroCommand, SimpleCommand, Mediator and Proxy) extend the Notifier class. It's impossible to change it without having to create copies of his subclasses.

I'm thinking about the following options:
- Copy Notifier, make facade changeable (By param in constructor of public property), copy all it's subclass to extend it.
- Copy all subclasses of Notifier and change the facade (less clear I guess)
- Change all the pureMVC classes so that you can give almost every class a reference to the facade. (But this is useless for the normal pureMVC)
- Make this into a alternative version of PureMVC
  (Unless one less someone has a better idea this seems the best option, pureMVC just doesn't seem flexible enough)

(I can't make a facade singleton for every sub MVC because this Notifier can only be hooked to one facade. Than we would still need to copy the whole framework for every sub MVC. )

A possible way to make the notifying system in pureMVC more flexible is to use compilation instead of extension to add Notifying capabilities. (Like you can use a custom subclass of EventDispatcher in as3.0)
This way I could extend the notifiers (MacroCommand, SimpleCommand, Mediator and Proxy) and change there notifier via there protected notifier property.
This seems okay, but this involves changing the whole framework, in my opion it's better to change it to a singleton less framework right away.

Do you guys have any ideas?

Many thanks,
Peter
2  Announcements and General Discussion / General Discussion / PureMVC without singleton's? on: February 05, 2008, 12:47:16
I'm thinking about making a singleton less pureMVC version. This because I want to be able to make sub PureMVC's.
We where building a very large game. This game had several mini-games and a pda that all had a lot of there own logic.
Because we wanted to be able to test games separately, didn't want every game to always exist and didn't want to have to risk to have non-unique names we created sub PureMVC's.
But, because PureMVC is build with several singletons we needed to copy most of the PureMVC classes to every sub PureMVC.
Another problem with singletons is that they don't get removed, so they always remember data. This forced us to build in our own destroy methods in the framework.
We felt like the only reason for all these problem's was that it is based on singletons.
We think that if you pass out all the members the correct references the framework should work as well.

Benefits
- SubPureMVC's without framework copies.
- More separation options.
- Les change off name conflicts.
- Easier unit testing.

Downsides
- Little risk on multiple instances of application facade, view, controller and model.

What are you guys thoughts about this?
Pages: [1]