1 Reply Latest reply on Jan 22, 2008 2:05 PM by lbonilla915

    Refactoring HttpService to RemoteObject

    lbonilla915
      We are working on our first Flex/Cairngorm/J2EE proof of concept for the eventual rewrite of a large application (We are still very new to Flex). We have not yet committed to a communication mechanism (HttpService or RemoteObject). So our current goal is to use HttpService and then switch over to RemoteObject after a while. Although Cairngorm's ServiceLocator pattern attempts to abstract away this decision, the sample code seems to be still coupled to the communication protocol.

      Here is sample code for calling a RemoteObject service in the Cairngorm documentation:
      var service = ServiceLocator.getInstance().getService( "productService" );
      service.getProducts();

      However, we are under the impression that if the service changes to an HttpService, the second line will have to be changed to:
      service.send();

      For an application that makes a lot of service calls, this would be a painful refactoring. Has anyone come up with a methodology to switch between communication protocols without having to refactor large amounts of code?