views:

38

answers:

1

I'm working on an app which will, like most apps, have a whole boat load of buisness logic, almost all of which will need to be executed both on the server and the Flash-based client… And I'm trying to figure out the best (read: least complex) way to implement the rules engine.

These are the parameters of the problem:

  1. The rules engine must both run in a web browser (ie, in Flash Player) and on the server. Duplicating the logic (eg, by writing a "server" version and a "client" version) would be an unacceptable risk.
  2. The input/output data is fairly complex, so serialization is a nontrivial problem. We are currently using AMF for all of our serialization needs, and using another protocol would add significant complexity… So it should probably be avoided.
  3. It is infeasible to implement a "rules description language". Experimentation has shown that rules are sufficiently complex that any such language would need to be Turing complete… Which would also add a significant amount of complexity.
  4. The rules engine will not need to make some, but not very many, service calls.

Currently, the best contenders are:

  1. Writing the code in ActionScript, then running it on the server. In theory it's possible to start up an AVM instance, get it long-polling a gateway, then pass data back and forth that way… But that seems less than ideal. Is there a "good" way of doing this?

  2. Writing the code in haXe. I don't know anything about haXe's AMF support, so that could be a deal-breaker.

  3. Something involving Tamarin. Seems like a viable option, but I haven't done enough research to tell either way.

So, what do you think? Are any of these options clearly better than others? Is there something I haven't though of that's worth considering?

Finally, thanks for reading this wall of text :)

+1  A: 

How much data are you talking about? You can use Air if you want to run it on the server and access a queue or something.

CookieOfFortune
There won't be a massive *volume* of data, but it will be reasonably complex .
David Wolever
Yeah, then just AMF over HTTP to communicate to both the Flex and Air clients. This way you can keep the same code base.
CookieOfFortune