Over a million developers have joined DZone.

Google Working Toward "Write Once, Run Anywhere" Native Web Apps

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Getting web apps to run natively on any user's machine is a major challenge in programming.  The rewards for breakthroughs in this area include much higher web app performance and more capabilites, which leads to greater adoption of the app.  A few startups have made great strides toward this new paradigm.  Appcelerator distributes a framework (Titanium) for building web applications that run natively on Android and iPhone OS.  Adobe AIR lets you run RIA's outside the browser on multiple operating systems.  

Perhaps one of the most ambitious projects in this field is Google's Native Client (NaCl) project, which runs directly on the operating system and leverages the hardware of various machines.  Recently, Google announced a significant accomplishment in adding NaCl module support for 64-bit x86 and ARM processors (chips that are used in most of our current PCs and smartphones).

Google NaCl is still in the prototype stage with more significant features in the works along with PNaCl (Portable Native Client).  The Portable NaCL variation, Google said, will be able to recognize a machine's hardware and run a Native Client application that is tailored to that machine.  Developers will simply write one PNaCl module that can run on any processor or operating system (NaCl modules already support Windows, Mac, and Linux).

Portable Native Client splits the NaCl software execution into two parts to make it work on more processors.  It allows the browser to translate the portable representation into native binary for any type of processor without accessing the source code of the program.  The first step translates the developer's code into LLVM bitcode; a portable intermediate state.  The second part of the process involves the specific NaCl modules for each specific processor architecture, which is detected by PNaCl.  These modules then translate the bitcode into machine code for the correct architecture.  This is also the stage in which security checks are run.  Google is still trying to determine how much overhead is added by these translations and learning how to reduce it.  


Credit: Google

NaCl executables are much faster compared to straight JavaScript execution.  NaCl executables had only a 3% drop in speed compared to an unmodified executable on x86-64 processors, and only a 10% drop on ARM processors.  With emerging technologies like SVG, WebGL, canvas, O3D, and Local Storage, a developer could build a web application that is just as good as a native application.

Google will have to convince users and browser makers to adopt this technology and it will have to show companies that NaCl is secure.  Even if no one adopts it though, it will still be relevant because Google has already it built into Chrome, Chrome OS, and Android.  Microsoft may not adopt Google's technology because of the benefits that NaCl would give to Google's App suite, making tools like Google Spreadsheet and Docs serious competitors for Excel and Word.  In the future, Google may even want to standardize the specifications for Native Client and its Portable Native Client counterpart.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}