Mobile development with JavaScript and HTML5

Feature:

The JavaScript and HTML5 trend continues for mobile development

By Jason Tee

TheServerSide.com

Do you remember just a couple years ago when there was still some uncertainty over whether JavaScript or Flash would be the client-side scripting winner? At the time, there still seemed to be some pros and cons for each argument. Ed Chipman certainly put in a valiant effort to explain as much in a 2011 blog post. He argued that Flash was the true write once, run on any browser solution, although he noted that JavaScript was rapidly gaining ground. Then, things changed.

Java and JavaScript have roared ahead of the competition for both mobile and web apps with the help of a new best friend: HTML5.

Jason Tee, Enterprise Software Architect

And in a Flash, it's gone...

In an era when almost 40% of Internet use is via smartphones and tablets, the term "client" is starting to be synonymous with mobile. Users expect browsers and websites to be compatible with both desktop and mobile devices. They want a seamless user experience even if they buy a new device every year and switch browsers as often as your aunt changes her hair color. In the same way, the line between developing mobile applications and web applications is starting to blur. Enterprises are moving to a mobile first strategy. Many web apps are being architected based on a mobile original and not the other way around.

The ax fell on Flash when Adobe pulled it from Google Play in 2012. The company announced that it would only issue updates and bug fixes through September 2013. They warned users to remove Flash from their Android devices before upgrading to Jelly Bean. Flash has become less of a run anywhere solution and more of an also ran. There's still some development going on for desktop Flash use, but Java and JavaScript have roared ahead of the competition for both mobile and web apps with the help of a new best friend: HTML5.

JavaScript gets mobile

As we wrote about extensively in December of 2012, HTML5 and Java mixed with some JavaScript is proving to be a hugely beneficial standard for mobile app development. Amazon is leading the charge with its hybrid apps that use HTML5 for web view, UI and style sheets, Java for native actions like screen rotation and memory management, and JavaScript bridges serving to tie it all together. While some developers have fears that Java EE might not be up to the task of making nice with HTML5 given its strong connection to HTML4, the transition is already turning out to be pretty smooth. For example, using JavaServer Faces as the UI layer for web apps still works if you simply update the renderer associated with a given JSF component.

JQuery and YUI puts the best scripts at your fingertips

Even developers who claim to despise JavaScript tend to speak fondly of jQuery. That's kind of like saying you hate steak because you don't like going to the grocery store and cooking your own dinner even though you'd chow down a juicy rib-eye if it's served to you at a restaurant. This framework is basically just a library of the most useful and reusable JavaScript components all collected in one place and served up at your convenience. Now jQuery is increasing its five star service with jQuery mobile for extra "write less, do more" goodness. They aren't saying these apps will run anywhere, but they do claim you can design a single app that will work on all popular smartphone, tablet and desktop platforms. Even more precisely mobile-targeted jQuery systems like PhoneJS and PhoneGap bring together HTML5, CSS, and JavaScript into one platform for fast development.

One very smart move by the jQuery mobile developers is the focus on making apps easy to brand. Even the biggest enterprises now want web and mobile apps that look pretty. Fortunately, rendering graphics is something JavaScript does very, very well. Pair that with CSS, and you get apps that are nice and glossy without too much effort.

A blank canvas (element)

Speaking of graphics, JavaScript is the only option for HTML5's enormously popular Canvas element. As Zack Grossbart points out over at Smashing Magazine, "It's all JavaScript once the page runs, but the frameworks take different paths to get there. Raphaƫl is written directly in JavaScript, but Paper.js uses PaperScript, and Processing.js uses its own script." With Flash leaving the mobile arena and the problems inherent in Applets plugins, it looks like JavaScript is the smartest choice for filling that canvas with the greatest confidence that most users on desktop or mobile clients will enjoy the full image-heavy experience they expect. Of course, Java SE Embedded is still playing with FX, so that could be an additional option coming up. We'll be sure to keep you posted here at The Server Side.

How is HTML5 impacting your delivery of mobile applications? Let us know.

11 Aug 2013

Related Content

Related Resources