As Grouchal mentioned, you won’t be able to share any physical components of your application between the two platforms. However, you should be able to share the logical design of the application if you carefully separate it into highly decoupled layers. This is still a big win, because the logical design of the application probably makes up a significant part of your development efforts.
You could wrap sections of the platform’s interfaces (iPhone SDK, etc.) that you use with your own interfaces. In doing so, you effectively hide platform-specific libraries and simplify the management of your design and code when dealing with platform differences.
With this, you can write your main application code so that it looks very similar on any platform - even if they are written in different languages. I find Java and Objective-C very similar conceptually (at least at the level at which I use it), and would expect to be able to achieve parity, at least in the following way:
- An almost identical set of Java and Objective-C classes with the same names and responsibilities
- Java / Objective-C classes with similar named methods
- Java / Objective-C methods with identical responsibilities and logical implementations
This in itself will make the application more understandable for different platforms. Of course, the code will always look different around the edges, i.e. When you begin to deal with presentation, streams, networks, etc. However, these problems will be handled by your API shells, which were once developed, that should have fairly static interfaces.
You can also win if you later add developers further applications that need to be delivered to both platforms, as you may find that you can reuse or extend your API wrappers.
source share