How Amazon discovered hybrid HTML5/Java Android app development

While their early approach to hybrid HTML5/Java Android mobile apps may have had a few hiccups, Java developers can still learn from it.

That was the topic of the keynote speech that Amazon's director of app developer services gave at the AnDevCon conference in San Francisco last week. In his keynote presentation, Ethan Evans delved into the topic of hybrid HTML5/Java development for Android applications, describing the journey Amazon took in uncovering best practices in HTML5 Android app development as they overcame each new challenge that arose. There is plenty to learn from Amazon's experience as one of the industry pioneers in the hybrid development sphere. Evans described the distinction of being on the bleeding edge of development simply by saying, "We built it poorly first."

Amazon's early mobile applications could do what was required; they just couldn't do it fast or efficiently. They didn't match the definition Amazon uses for high performance in an HTML5 or hybrid app; it must be indistinguishable from a native app in latency, feel and feature access. While admitting the failings of early efforts, Ethan said he doesn't like to think of Amazon's initial approach as the "wrong way," he likes to think of it as "another way" to build apps. It's just not the best way.

Hybrid mobile development: Is there a best way?

There may not be one right way to do hybrid mobile development, but there are many best practices that organizations can implement to speed up time to deployment while boosting performance. The practices described in Evans' keynote helped his team cut their application's startup time and transition between pages by 50%, going from eight seconds to four seconds on the typical device. Shaving off four seconds took months of ripping the guts out of the app and rewriting it. Learning from Amazon's experience and incorporating their hard-learned best practices may help enterprise application development organizations avoid the pitfalls they encountered.

Why HTML5?

Evans, who lived through the hype of Java being billed as "write once, run everywhere," was understandably skeptical about the identical claim being made for HTML5. Interestingly, the top attractor for Amazon to use HTML5 wasn't interoperability at all. Amazon does create some apps that work across multiple platforms, but their primary interest is Android applications.

From Evans' perspective, the most compelling reason to incorporate HTML5 into your mobile applications is to get the ability to update the app without requiring an upgrade on the device user's side. This capability makes it both easier and safer to manage apps -- permitting developers to roll out or draw back updates as needed. In the brave new world of continuous deployment and live testing, that's a huge advantage. "Bad bits downloaded to a client device are bad bits," Evans said. HTML5 helps to avoid clients downloading "bad bits."

Making decisions about hybridization

Evans described many tips and tricks for getting the most out of hybrid Android app development in his presentation. But the biggest issue many organizations who are adopting a hybrid strategy face is deciding what to do in HTML5 and what to do in native code. Amazon tends to use HTML5 for user interface and Java for the back end or "guts" of an app in order to get the best of both worlds.

That being said, HTML5 in its current form is ideal for static or low interactivity tasks and more difficult to work with to create highly interactive games. So, the No. 1 question to ask as you design your blended app is the same as for any other app: "How do I make the customer happy while saving my own organization time and money?" With Amazon's best practices and insights about their mobile development experience, answering that question just got a little easier.

Follow Cameron McKenzie on Twitter (@potemcam)

Recommended Titles

Head First Mobile Web by Lyza Danger Gardner
Professional Android 4 Application Development by Reto Meier
Mobile Development with C#: iOS, Android, and Windows Phone by Greg Shackles
What's New in Java 7? by Madhusudhan Konda
The Well-Grounded Java Developer By Martijn Verburg

Next Steps

The learn cause of the Amazon S3 outage

Dig Deeper on Software development best practices and processes

App Architecture
Software Quality
Cloud Computing