Writing a separate application, from scratch, for each unique mobile platform is expensive. If you want to build an application for multiple platforms, or extend an existing one beyond your original market, the most efficient option is to reuse much of your existing code across other platforms. Even better would be to do that in a way that preserves native quality UI.
Of course cross platform must be the answer, but how? What would most appeal to Android and iOS focused developers building native apps today?
Several options have been created to address this need, including Xamarin and Cordova. I’d like to specifically mention JUniversal as another alternative, which allows you to write shared, cross platform code in Java.
The vision of JUniversal came from some guys at Nokia who possess considerable expertise both in Java and in building cross-platform apps. They built this tool to provide an elegant way to translate source code and make it useful across multiple platforms. JUniversal offers you the freedom to write your shared code in Java and then translate it to C# (available now) or to C++/Objective C++ (coming soon). You can also combine JUniversal with Google’s j2objc translator to translate Java to Objective-C for iOS.
Beyond the source translation functionality, JUniversal also includes a set of libraries, called JSimple, that provide cross platform friendly versions of (non-UI) APIs needed by most mobile apps. These include:
· OAuth (based on Scribe)
· Unit testing (JUnit)
· File & network I/O platform wrappers
· Collections—HashMap, ArrayList, etc. (based on JDK/Harmony)
· Logging (based of SLF4J/Logback)
· About 20K lines currently
Why source translation?
A key design goal for JUniversal is to preserve comments and formatting, producing translated source that looks much like how a human would write it. Therefore, the debugger, profiler, exception stack traces, etc. all work exactly the same as they do with hand written source, so that translated source code can combine seamlessly with native code. There’s no language impedance mismatch.
On the spectrum of cross platform technology, JUniversal is arguably among the lightest weight and most native-like, as it uses the native platform programming language (via translation), native compiler, native debugger, native UI design tools, etc. As for the UI, the intention is that it is hand written natively, to provide the best user experience.
And JUniversal is free.
Here is a simple diagram of the architecture:
At MS Open Tech, we love these kinds of moonlight projects and we encourage the JUniversal team to persevere on this project. It’s great stuff!
Please help them out by sharing feedback from your experiences with JUniversal via on this blog or the JUniversal project site: http://juniversal.org. Check it out.