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
var service = ServiceLocator.getInstance().getService(
However, we are under the impression that if the service
changes to an HttpService, the second line will have to be changed
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?