views:

61

answers:

1

I want to use AIR to create an OFFLINE version of a "webapp" kind of website (lots of ajax, front end code).

Haven't been much further than the HelloWorld example, I keep wondering: how do you design your code, to maximize code reuse between the website (say in php or Java or .Net), and the AIR app ?

Can you actually re-use 100% of the front end code, provided that it is designed to account for the AIR app ? How would you go about doing that ?

For example, the website makes many Ajax calls which have latency, and uses listeners. The AIR app doesn't need listeners it could run database requests synchronously, and it doesn't need to run ajax calls right? Would you write an abstraction layer for that ? So that the same calls on the AIR app will not do a xmlhttp but instead implement the server-side code with AIR; and call the listener ? So you don't have to rewrite the front end code patterns ?

Does this make sense ? It's really hard to search on Google. I'm thinking there must be a good article somewhere of somebody who went through and perhaps a framework to do that ?

A: 

I've written a few Adobe Air Apps. My suggestion to you is that you think of your app in terms of services that will be provided by Air or a web service. That is the part of your code that will have to be duplicated.

Therefore, you should isolate all the Adobe air specific code, and provide a way for a web service to do the same thing: say, store preferences, read a file, query a db.

When deploying the app, you can choose to load the the code that connects to air "services" or to web services.

Juan Mendes

related questions