开发者

Using one remote object and multiple destinations

In my Flex app, I use one remote object and multiple destinations. Is that a bad idea? It seems to be working just fine except for the one or two fringe cases:

  1. It's bad design, but we use the same method name on t开发者_高级运维wo different destinations and they seem to conflict when they're called at the same time.
  2. Logging errors show a method assigned to one destination as being associated with another.


As you've guessed. This is bad design for a multitude of reasons:

  • Confusing - you may understand your convention of one object/two destinations but this will present problems should anyone else attempt to contribute or maintain your work.
  • Logging/Debugging Issues - Should a problem arise down the road, having the logger reporting incorrect information could seriously overcomplicate bug tracking
  • Unnecessary - I am not familar with your code but in my experience with Remote Objects it is trivial to use a few different ones

My suggestion would be to wrap two remote objects into a single parent object. You can pass this single object/class around and still have access to both destinations.

OR

If you're anticipating adding multiple features, create a singleton class with methods for handling remoting logic. This will keep Remoting access consistent across your application and leaves the destination logic contained in one place.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜