Live data from Hacker News

JUniversal: A new, Java-based approach to cross-platform mobile apps

msopentech.com

11–20 of 21 posts

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#11
This is how Google Inbox and Google Spreadsheets works. See the slides from my recently produced GWT Create Session (http://t.co/ZvoaHxCoZT). J2ObjC slide deck here (https://docs.google.com/presentation/d/1mW_Plm5jAygELf7qjVK7...) Videos of the conference will be online soon.

Prior to that, some 20% Googlers also produced the PlayN library (https://github.com/threerings/playn) This was taken over by Michael Bayne who added an iOS backend by Bytecode -> IKVM -> Mono conversion. I beleive j2objc and RoboVM backends exist now as well.

The major benefit of the j2objc approach is the avoidance of GC in favor of ARC, the conversion of message-sends into C-method calls when possible, and integration with existing iOS toolchain.

When we started, it seemed like an iffy idea, but after developing a product delivered to millions of users on a high volume site (gmail) that has 70% code sharing, and being able to simultaneously develop, test, and deploy across the platforms reasonably efficiently, a lot of skeptics have become converts to the concept.

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#12
post #5

Well, those who have done some iOS or Android development know that any good app requires extensive hacking. Unfortunately this doesn't work in a cross-platform manner. For the simplest applications having a cross-platform framework is fine but if you really want to make an immersive app for iOS or Android you need to go native. Now this is not to say that some applications will work perfectly fine under this framewo…

    >Now this is not to say that some applications will work perfectly fine under this framework.
Probably most handy in line of business applications where a functional UI that works for your entire organization would be preferred over platform specific immersion.

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#13
post #7

libgdx also uses robovm for ios, but prefers gwt for web. since its 'just java' desktop and android dev comes free. If you're into build *gl based guis it's a great cross platform toolkit in disguise (especially with scene2d).

> desktop and android dev comes free. As long as you stick to Java 6 and APIs common to both platforms.

GWT has supported Java 7 for over a year.

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#14

This is how Google Inbox and Google Spreadsheets works. See the slides from my recently produced GWT Create Session ( http://t.co/ZvoaHxCoZT ). J2ObjC slide deck here ( https://docs.google.com/presentation/d/1mW_Plm5jAygELf7qjVK7... ) Videos of the conference will be online soon. Prior to that, some 20% Googlers also produced the PlayN library ( https://github.com/threerings/playn ) This was taken over by Michael Bay…

I'm sold on the concept. I especially like the fact that you're using ARC on iOS; my intuition is that this would interact better with the platform and native development tools than something like Xamarin which requires GC.

Do you have a way of doing local storage, i.e. to the file system or a database, in cross-platform code? Or does that have to be platform-specific? How about making HTTP/HTTPS requests?

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#15
post #7

Earlier quoted context omitted.

> desktop and android dev comes free. As long as you stick to Java 6 and APIs common to both platforms.

GWT has supported Java 7 for over a year.

How does that help Android native apps?

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#16

This is how Google Inbox and Google Spreadsheets works. See the slides from my recently produced GWT Create Session ( http://t.co/ZvoaHxCoZT ). J2ObjC slide deck here ( https://docs.google.com/presentation/d/1mW_Plm5jAygELf7qjVK7... ) Videos of the conference will be online soon. Prior to that, some 20% Googlers also produced the PlayN library ( https://github.com/threerings/playn ) This was taken over by Michael Bay…

I'm sold on the concept. I especially like the fact that you're using ARC on iOS; my intuition is that this would interact better with the platform and native development tools than something like Xamarin which requires GC. Do you have a way of doing local storage, i.e. to the file system or a database, in cross-platform code? Or does that have to be platform-specific? How about making HTTP/HTTPS requests?

We dependency injection network and database abstractions. For network, because Google loves protobufs, we have a network channel abstraction between client and server, or between processes, that can send/receive protos. For storage, we have an IndexDb like abstraction.

We hand-rolled our dependency injection stuff, but if we did it again, we'd just use Dagger 2 which works on all platforms.

We are second guessing our decision to go with an IndexDB abstraction. The code to use this is not very maintainable, and so we're looking at moving to a SQL-lite-ish kind of abstraction for storage. It might still be IndexDB underneath on some platforms, but operations will be higher level.

You can't get away from some platform native APIs. In general, abstract them, or copy the ones that PhoneGap already designed, and dependency inject the real implementations (instead of the PhoneGap approach which is to serialize RPC calls through URLs from a JS VM)

You can imagine a class like this:

public class InboxImpl {

   @Inject

   public InboxImpl(SQLStorage sql) { ... }


   public List findMessagesByAuthor(String author) {

      return sql.from("messages").select("body","author").where("author").contains(author).asList();

   }

}

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#17
The approach is similar to the one chosen by Haxe. I would keep a close eye on the progresses made by this open source language. For the moment the most mature translation target is the C++ one, however there are also targets for Java and C#. Sadly the community seems to be 95% focused on mobile gaming.

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#18
This is similar to Kirin framework (http://github.com/futureplatforms/kirin)

Cross platform development in Java is compiled to JS via GWT and can be deployed anywhere Java or JS is available.

It powers apps with hundreds of thousands of users on iOS, Android, Windows, Windows Phone and Xbox One.

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#19

The approach is similar to the one chosen by Haxe. I would keep a close eye on the progresses made by this open source language. For the moment the most mature translation target is the C++ one, however there are also targets for Java and C#. Sadly the community seems to be 95% focused on mobile gaming.

Haxe is robust though; it's the libraries that are developed based on the focus of the community. If you want to develop apps with it, you can by just developing a lib. The language & toolchain are robust and with haxescript you can nicely try before you convert.

Re: JUniversal: A new, Java-based approach to cross-platform mobile apps

#20

This looks awesome! I can hardly wait for the promised C++ and ObjC++ support. I wonder how much gtime the main committer, Bret Johnson, is able to devote to this project.

I wonder how if they are going to implement pure C++ support. And in that case how they are going to support GC. Any idea?
Post reply on HN