views:

18

answers:

1

In our system, the code which exists on the client side (in Flash and Javascript) mirrors the code that exists on the server side (e.g. in Python or PHP), normally with respect to the models, the methods available for those models, and the unit tests written for them. This becomes a problem in systems where you want to minimize data transfer (e.g. multiplayer games).

I do not want to write the same code and unit tests redundantly for both the client and server, but I don't know of any standard solutions to deal with this.

Basically, I want a language/compiler which can produce models and methods for three main languages: Actionscript, Javascript, and any server language.

Does something like this exist?

A: 

Basically, I want a language/compiler which can produce models and methods for three main languages: Actionscript, Javascript, and any server language.

Not that I know of.

Frameworks like Ruby on Rails and Grails use convention and code generation to do a lot of that work. Maybe you can take a page from that book and do some of it as well.

I'm leery of code generation. It's a seductive idea - how can saving yourself typing be a bad thing?

It's dangerous when you generate things like unit tests. If they're so simple that a code generator can create them, I'd question their value. Sounds like too much boilerplate to me.

duffymo