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 / Architecture / RSL versioning on: July 12, 2010, 03:03:25
Hi all,

This question is not strictly related with PureMVC but I know that many experts are visiting this forum.

I would like to know if there are some techniques to allow versioning runtime shared library. Suppose i have a rsl library under name(mylib_v1) used across many applications that are online all the time. Suppose I found a bug in my rsl library and I would like to generate new version of this rsl swc under new name(mylib_v2) and only change it without recompiling my applications. How can I specify which version of library my applications should load?

Thanks in advance,
Adrian
2  PureMVC Manifold / Standard Version / Re: Custom interfaces and inheritance in PureMVC on: January 08, 2010, 02:33:09
Hi,

1. A Class implementing interface HAS to implement all methods in that interface as public methods, however it may contain other methods, event if they aren't declared in the interface.

This means Your PageMediator has to implement all methods from IPageMediator(and also all method declared in IMediator because IPageMediator extends IMediator). Of course you can add any number of other methods to your PageMediator class.

2. If you extend PageMediator which implements IPageMediator, your concrete mediator also is PageMediator and IPageMediator, thats the rule of inheritance. Your concrete mediator inherits all public (it means also your interface methods because they are public) and protected methods.

Example:
If a USACitizen implements IEnglishSpeaker interface, it means you can be sure he can speak english, but he can also spean spanish or polish but you cannot call him ISpanishSpeaker or IPolishSpeaker because he didn't explicity tell you he does.

Hope this helps
3  Announcements and General Discussion / General Discussion / Re: final proxy classes (a question about style) on: December 24, 2009, 02:11:55
No problem, it's only my humble opinion ;)

Sometimes, the data parameter in the constructor of proxies helps me when I want to configure them from external XML file. In that file I have for example endpoint address to my webservice. I parse that file with ConfigProxy (which is the first proxy registered in my app) and when config file is parsed and ConfigVO is ready to use, I register and configure the remote service proxies at once, passing ConfigVO into the constructor of proxy.
When you're deploying your application to the destination server, the endpoints of services will mostly be different than those from development server, so you don't have to recompile your app with new endpoint address, you just change them in config file.

Thats advantage of using data parameter in constructor.
I think there could be a number of situations where the data parameter would be helpful.

I don't know if you're using multicore or singlecore version, but i think better place for initialization or other things done when proxy/mediator is registered, is onRegister(). In multicore doing too much in constructor of proxy/mediator is a source of errors like "Multiton key not yet initialized...", so I learned to use onRegister() rather than constructor.
4  Announcements and General Discussion / General Discussion / Re: final proxy classes (a question about style) on: December 22, 2009, 03:44:25
My proxies have only one parameter - the data, because i've never had an occasion to give my proxies names at runtime (they just are public static const). So I would choose gate nr 2.

I don't know if final keyword would help in increasing performance of application, but if you're looking for places for performance improvement, you could try.

Proxies as singletons would result in mess in my opinion. Testing PureMVC application isn't easy and making proxies singletons would make this process much harder. You already have Facade singleton which is used to retrieve proxies. Singleton proxies would also remove the possibility to remove and register them at runtime.
5  Announcements and General Discussion / Getting Started / Re: Role of StageMediator? on: December 18, 2009, 10:03:48
Thanks Cliff :)

You're right, my implementation only fits Flex, for Flash project it is necessary to change viewComponent's type to DisplayObject.
6  Announcements and General Discussion / Getting Started / Re: Role of StageMediator? on: December 18, 2009, 05:17:39
I think they could, but personally I've created command for registering mediator for specified viewComponent. I've also created VO that holds reference to MediatorClass and viewComponent instance. Here's the code (I've omitted import statements for clarity):

RegisterMediatorForComponent.as
:
public class RegisterMediatorForComponentCommand extends SimpleCommand implements ICommand
{
  public function RegisterMediatorForComponentCommand()
  {
    super();
  }

  override public function execute(notification:INotification):void
  {
    var registerMediatorVO:RegisterMediatorVO = notification.getBody() as RegisterMediatorVO;
    if(registerMediatorVO)
    {
      var MediatorClass:Class = registerMediatorVO.MediatorClass;
      var viewComponent:UIComponent = registerMediatorVO.viewComponent;

      if(MediatorClass && viewComponent)
      {
        var mediatorName:String = MediatorClass.NAME as String;
        if(mediatorName && !facade.hasMediator(mediatorName))
        {
           try
           {
             var mediator:IMediator = new MediatorClass(viewComponent) as IMediator;
             if(mediator)
             {
               facade.registerMediator(mediator);
             }
           }
           catch(e:ArgumentError)
           {
             trace("RegisterMediatorForComponentCommand Argument Error");
           }
         }
       }
     }
  }
}

RegisterMediatorVO.as
:
public class RegisterMediatorVO
{
  public var MediatorClass:Class;
  public var viewComponent:UIComponent;

  public function RegisterMediatorVO(MediatorClass:Class, viewComponent:UIComponent)
  {
    this.MediatorClass = MediatorClass;
    this.viewComponent = viewComponent;
  }
}

Sample usage:
:
var registerMediatorVO:RegisterMediatorVO = new RegisterMediatorVO(LoginFormMediator, loginForm);
sendNotification(AppNotifications.REGISTER_MEDIATOR_FOR_COMPONENT, registerMediatorVO);

I Hope this helps.
7  Announcements and General Discussion / Architecture / Re: SWFAddress and StateMachine on: November 26, 2009, 01:12:15
Thank you for reply. I'll check Sea of Arrows for a useful hints :)
8  Announcements and General Discussion / Architecture / SWFAddress and StateMachine on: November 25, 2009, 01:32:43
Hi all,

In my project I use StateMachine utility for managing my app's states. I would like to add deep linking functionality and here are my questions:

- How to use these 2 utils properly in PureMVC architecture? Create BrowserProxy and listen to SWFAddress events and update app state based on actual fragment?

-How about "internal" change? Listen for entering notifications for each state and apply fragment? Or first change url, and then change the state?

Thanks in advance
Pages: [1]