A roundup of current cross-platform mobile development solutions

Mobile development is a rapidly changing area of software engineering. The mobile industry is growing so fast that everybody’s just rushing out apps to the market using any means possible. We have reached a point though where there’s an appetite for cross-platform development as mobile apps grow larger and more complex and thus accurately replicating the features in parallel code bases is becoming increasingly hard.

I’m writing this post as a reference sheet and I’ll add more info on each language and framework as I find out more about them. As an overall structure I classify the solutions around the programming languages and discuss the shortcomings and advantages of each.

JavaScript

Apache Cordova and friends

There are several frameworks which aim to leverage established web technologies to build cross-platform mobile apps. Apache Cordova (formerly PhoneGap) is probably the most popular and more recently there’s Facebook’s React Native as well.

There are many reasons why this is a bad idea: performance, memory usage, battery usage, UI platform fidelity, debugging in native bindings – just to name a few.

I want to emphasize how big a problem performance is. The solution relies on the JavaScript interpreter. JavaScript is an extremely permissive language with many corner case constructs. Yes, there are ways to do JIT compilation and other runtime optimizations but JavaScript is the nightmare language for these techniques so the effectiveness of optimizations will be limited.

Objective C

This language is dying with Apple having committed to make Swift the primary language for iOS and OSX development.

Swift

It’s a new language with an interesting blend of features. It’s biggest problem is that it’s been created at Apple. Consequently any non-Apple developed operating system will be supported as a second class citizen. Put it plainly, it’s against Apple’s business interest for Swift to run best on anything but iOS and OSX. The language, compiler and certain tools have been recently open sourced but Linux is the only other OS supported at this time and there’s no other OS in plans.

As with Mono as the .NET implementation on Linux I’m sure the Linux developer community will embrace Swift just as warmly – not.

C/C++

These languages are only popular for cross-platform game development. No GC, no memory bounds safety checks and the simplicity and limitations of C plus the complexity of C++ make them a scary proposal for modern software development.

C#

Xamarin and Visual Studio

Seems technically sound but Microsoft has a lot more work to do to convince developers that they are no longer the evil empire of the 90s. C# has been around for almost as long as Java yet it’s still a niche language yet arguably being better designed and more feature rich.

Update: As announced at Build 2016, Microsoft is now including Xamarin into Visual Studio for free. This is coupled with two important changes: making the Xamarin SDK open source and donating the Mono code base (with some extra improvements) to the Mono foundation under an MIT license. My comment on Microsoft’s image stands, but these are all moves in the right direction to start fixing that image.

Java

JVM on iOS

Oracle

Does not have ahead of time compilation tech and no JIT VMs are allowed on neither the Apple AppStore nor on Google Play. The reasons are sound because both companies want to disallow self modifying binaries which represent an increased security risk.

As a result the Oracle JVM on ARM is slow. Additionally, the JVM is linked to the app and adds an approximately 16 MB overhead to each and every app. Both of these prevent it to become a contender in mobile.

Intel

Intel has a the Multi-OS engine tech preview: a port of ART to iOS which is linked to the app. I detailed this solution in my post on AnDevCon 2015 Santa Clara.

Java cross-compiled to iOS

j2objc

I first heard of j2objc while reading the ArsTechnica article on the internals of Google Inbox.

It generates Objective C source code to be compiled on iOS. It has no bindings for the UI as the project’s philosophy is that native UIs are of the highest quality.

Google also integrated j2objc into a toolchain which can support Web apps too.

Google’s motivation to open source the associated toolchain: the perfectly round number (0). They have no incentive to make it easier to develop apps for iOS or any other future competing OS.

RoboVM

I also touched on RoboVM in my post on AnDevCon 2015 Santa Clara.

XMLVM

It’s a Java to iOS binary compiler. There doesn’t seem to be any active development of the project.

Codename One

Java to Objective C with a cross-platform UI. Think of the Swing UI toolkit. The biggest drawback is the common denominator pattern: the experience of developing for it is identically limited on all platforms. You can’t just use any Java library, there’s no package manager and there’s a subscription model for getting all the features and power of the framework (and all the source code).

Just recently the Codename team did release the iOS cross-compiler as a separate project: ParPar.

Skeleton native UI with business logic running on the server

I just remembered about this option and I’m aware of only one entry in this category: Tabris. It’s the Eclipse Remote Application Platform (RAP) port to mobile. It has two downsides: 1. offline mode is highly problematic and 2. it’s not open source.

Conclusion

So far it’s suffice to say that any framework whose development is driven by a company with a mobile OS is at a disadvantage. The reason is simple: it’s really hard to justify spending money on a technology that disadvantages your own OS and its revenue stream.

Having a paywall around the technology isn’t helping its adoption either. It would be nice to see the RedHat and Spring driven open-source with business grade support reach mobile tooling as well.

Is there a perfect solution? I’ll outline my analysis in a subsequent post.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s