I’m working on a project that requires developing an android application for a galaxy tab, and after that, develop an application with the same purpose that runs on a desktop computer using Ubuntu 10.04.
My goal is to avoid doing the same thing over for a different platform. I guess that I can’t have the exact same application running on android and ubuntu (without an android emulator).
Assuming I program it with java, what would be the requirements or which design suggestion would you provide so that I can reuse most of the code for both applications?
I’m more into the C++ world, what I’d try to do is to create some classes with the high-level an platform independent code, and then what would have to be rewritten is just the platform specific code. But I certainly have no idea of how to do it with java.
try to split your code into manageable layers.. & use these layers as dependencies for your project… with careful planning you would have a very minimal set of changes to be made for the project…
there are a lot of articles on the web to guide you through these things.. having said that design boils down to how you categorize your app..
usually we have 3layers
1. DAO -> mainly dealing with data access (like db access etc).
2. Service -> relating to Business Logic, this sits on top of dao.
3. Presentation -> relating to UI (like struts, velocity etc.,)
for android app,
in your case you can replace your DAO with webservice calls, your service might need a bit of tweaking & your presentation layer needs to be built from scratch.
hope this helps.