Hacker News new | comments | show | ask | jobs | submit login

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.

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 {


   public InboxImpl(SQLStorage sql) { ... }

   public List<Messages> findMessagesByAuthor(String author) {

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



Applications are open for YC Winter 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact