Dev Watch

Blog archive

Guess Who's Promoting Java for Cross-Platform Mobile?

I never thought I'd see this day: Microsoft is proposing Java as a cross-platform mobile development language.

For almost a month, Microsoft JUniversal tooling has been in public preview as the company seeks to smooth out the rough edges in its project to translate Java code into C#, with iOS translation on tap.

The irony is almost unbelievable, but I guess anything goes in this new age of openness, interoperability and inclusion. Let's all play together; we can figure out those pesky how-to-make-money details later.

Younger coders might not be familiar with the legendary Sun Microsystems vs. Microsoft wars of the late '90s and early '00s, stemming from Microsoft's own Java Virtual Machine used in Internet Explorer. Microsoft ended up having to pay a couple billion dollars in assorted fines and fees in its brouhaha with the then-owner of Java -- yes, that's right: "billions" with a "b." As the legal dust was settling, Microsoft came out with its own little project called the Microsoft .NET Framework using its new C# language.

Now Microsoft is saying: "OK, fire up Visual Studio and write some Java code to build a Windows/Windows Phone app." Well, kinda.

The JUniversal project was debuted late last month by Microsoft Open Technologies, the subsidiary formed to deal with, well, integrating open technologies into the Microsoft ecosystem and vice versa.

Cross-Platform Options
[Click on image for larger view.] Cross-Platform Options (source: Microsoft Open Technologies)

The goal is mobile dev nirvana: writing cross-platform code that provides native functionality, performance, and look-and-feel across Android, iOS and Windows/Windows Phone OSes. Dozens and dozens have tried, many have claimed success, but we're still waiting for the dream to be realized -- a true champion to be proven and crowned.

"Several options have been created to address this need, including Xamarin and Cordova," wrote Open Tech's Eric Mittelette in a blog post last month. I'd like to specifically mention JUniversal as another alternative, which allows you to write shared, cross-platform code in Java."

Note that this isn't proposed as that one elusive tool to do everything. It's aimed at parts of your codebase that can be shared easily, such as business logic. "As for the UI, the intention is that it's handwritten natively, to provide the best user experience," said Mittelette.

Which makes me wonder how this would work with the upcoming React Native project being developed by Facebook, a nascent JavaScript approach designed to be a new way of doing the UI view in the Model-View-Controller (MVC) scheme. Microsoft just announced a project to provide support for the React JSX flavor of JavaScript in the upcoming Visual Studio 2015, which knows a thing or two about MVC. Maybe JUniversal could provide part of the framework to use React Native components -- UI building blocks that can run on Android or iOS and provide full native functionality. Somebody please look into that and get back to me.

JUniversal Architecture
[Click on image for larger view.] JUniversal Architecture (source: Microsoft Open Technologies)

Meanwhile, Microsoft is asking mobile developers to look into JUniversal and get back to them.

"Want to try it out, as a pilot user?" asked project head Bret Johnson in a blog post last month. "Please do. Here's the deal: You'll likely run into some rough patches along the way, but in exchange for that you'll get one-on-one help from us, getting things working with your app. We need that feedback to improve things. So please both try it, via Getting Started, and reach out to us as you have questions and issues, so we can help you and fix up the doc/code for everyone thanks to your feedback."

The JUniversal project site goes into more detail. "The Java -> C# translator is basically feature complete," it says. "Expect some translation issues, but they almost always cause C# build errors, and the course of action then is to either tell us (so we can tweak the translator) or tweak your Java source code to avoid. Also expect some issues with incomplete doc, etc."

JUniversal was envisioned by some people from Nokia, acquired by Microsoft. In addition to the code translator, its other main component is JSimple, a set of libraries with APIs for non-UI stuff used across apps, such as authentication, JSON support, unit testing and so on.

"We're also looking for feedback on the JSimple API," says the project site. "Would you do anything different there in terms of API design, consistent naming, Java collection class enhancements, etc.? In some ways it's an opportunity to improve (at least modestly) on core Java APIs. If that excites you, input is welcome. Obviously, JSimple bug and feature requests are welcome, too."

So dive in, get your hands dirty and get back to Microsoft with your feedback. And get back to me on this JUniversal/React Native thing. Who knows? It could be the beginning of a beautiful friendship.

Posted by David Ramel on February 24, 2015