fragmentation. Vic Gundotra, VP of
engineering at Google, claimed that
“even Google was not rich enough to
support all of the different mobile platforms from Apple’s App Store to those
of the BlackBerry, Windows Mobile,
Android, and the many variations of
the Nokia platform,” 6 and this was before HP webOS, MeeGo, and other platforms emerged.
In this article we discuss some of
the strengths and weaknesses of both
Web and native approaches, with special attention to areas where the gap is
closing between Web technologies and
their native counterparts.
native Code vs. Web Code
Implementing a software app begins
with code. In the case of native code,
most often these days the developer
typically writes in a C dialect, as in the
case of the iPhone. In our work at Nitobi
( http://nitobi.com/) and on PhoneGap
( http://www.phonegap.com/), we have
had plenty of experience wrestling with
the various mobile platforms from a
native development perspective.
Of course, for various market or organizational reasons most developers
or teams must support apps on multiple smart platforms. Want to write an
app in native code and hit every single
mobile operating system? No problem
if your team has the skill sets shown in
the accompanying table.
What makes things even more complicated are the differences among the
actual platform SDKs (software development kits). There are different tools,
build systems, APIs, and devices with
different capabilities for each platform. In fact, the only thing these operating systems have in common is that
they all ship with a mobile browser that
is accessible programmatically from
the native code.
Each platform allows us to instan-
tiate a browser instance, chromeless,
and interact with its JavaScript inter-
face from native code. From within
that Webview we can call native code
from JavaScript. This is the hack that
became known as the PhoneGap tech-
nique pioneered by Eric Oesterle, Rob
Ellis, and Brock Whitten for the first
iPhone OS SDK at iPhoneDevCamp in
2008. This approach was later ported
to Android, BlackBerry, and then to
the rest of the platforms PhoneGap
supports. PhoneGap is an open source
framework that provides developers
with an environment where they can
create apps in HTML, CSS, and JavaS-
cript and still call native device fea-
tures and sensors via a common JS API.
The PhoneGap framework contains
the native-code pieces to interact with
the underlying operating system and
pass information back to the JavaScript
app running in the Webview container.
Today there is support for geolocation,
accelerometer, and more.
user Interface Code
Things aren’t as pretty when it comes
to the user interface. Most native plat-
forms have wonderful abstractions for
common user-interface controls and
experiences. No two platforms have the
same, or even similar, user-interface
paradigms, let alone APIs to instanti-
ate and access them. The Web plat-
form is consistent, for the most part,
but the number of built-in or SDK-
included controls is limited. You have
to roll your own. Sometimes the differ-
ences among browsers can cause pain,
but—at least in the modern smart-
phone world—most devices sport the
very capable WebKit rendering engine,
and only small differences prevail.