Feeds selected
Thu 18 Apr 2013
-
06:30 pm

I am discussing mobile application development with the IT manager of a provider of online content and services to millions of users, when the conversation touches on HTML5. He tells me:
“On September 11, 2012, Mack Zuckerberg stated that the biggest mistake made by Facebook was betting too much on HTML5 as opposed to native. The very next day I got a call from my boss asking me if I was sure our company was not making the same mistake.”
Since that day, I've heard similar stories over and over again as the “Facebook dumps HTML5” headline spread through the web and reached even a non-technical audience. Many IT directors and software architects that had been pushing HTML5 as the future of mobile within their organization began to see their strategy questioned by upper managem
ent.“We provide customers with native applications for iPhone, iPad, and Android to access our online content and services. Each application was launched at a different time and outsourced to a different supplier. Eventually the apps became misaligned to the point that managing updates and adding new features has become a painful process. HTML5 looked like the ideal solution to overcome that, but now I am no longer sure.”
Indeed, HTML5 was hyped as the ultimate write-once-run-anywhere solution for mobile, solving all the problems of cross platform development and device fragmentation. This has been proven to be plainly wrong. Not surprisingly, the old saying “no silver bullet” also applies to mobile applications. On the other hand, HTML5 remains a powerful technology for mobile development, a fact that is demonstrated by well-crafted executions like the LinkedIn app. When it comes to choosing HTML5 over native or vice versa there is, of course, no universal answer. There are, however, key decision criteria.
Let's Take A Step Back
The first question to ask is, do you actually need a mobile application? No matter the selected technology platform, development and maintenance of a mobile application can be costly, and a mobile website might be preferable. By leveraging responsive design techniques, the browser can be instructed on how to best render the web page content depending on device display and input capabilities, such screen size and orientation, as well as touch-based interactions (a well-known example is the Boston Globe website.)
From the user perspective, this solution provides a traditional client-server web experience, with page-to-page navigation implying page reloads and redraws (completed in a possibly short but unavoidably noticeable time.) Also on the downside, network connectivity is always required (no offline modality), no device features are available, and discovery and monetization cannot happen in the native platform application store.

The browser is also an app.
From Web to Native: The Steps In Between
After a business case for a mobile app has been established, the question arises as to which platform to support. Unless the app is targeting a niche vertical or geographical market, chances are that it should support multiple platforms, namely iOS and Android (and its fragmented device base) to say the least. Viable approaches span web and pure native technology, with various intermediate degrees—single page applications, hybrid applications, cross-compiling frameworks and multiple native apps.

A web app is implemented with modern web technologies and unlike a mobile site it is constructed as a single, self-modifying web page (such as Google Gmail), with application and presentation logic moved to client-side. HTML5, CSS3, and JavaScript provide plenty of opportunities to deliver advanced user interfaces that convey the feeling of an application. Bleeding-edge browser APIs, such as user media, geo-localization and local storage (on their way to standardization), can be leveraged, depending on the level of support by the mobile browser. A single page application can be typically added to the device home screen as web app, which is essentially a bookmark that launches the browser. Updates are transparent to the user, as they happen server-side. A notable example of this approach is the Financial Times app (seen at the top of this post), which leverages the distribution in the open web as opposed to proprietary application stores.
The hybrid approach is based on software frameworks that package HTML5, CSS3 and JavaScript code into a container that embeds a webview (leveraging the native HTML rendering engine) and an integration layer to the mobile operating system. The webview is used to display a single page application. Thusly wrapped, the application is seen by the mobile operating system as truly native. Discovery, purchase, installation and updates happen via the application store. A popular framework of this kind is Adobe Phonegap (based on the Apache Cordova project), which powers the Wikipedia mobile app. Its integration layer enables JavaScript code to access software and hardware features such as contacts, notifications, local storage, as well as GPS, compass and camera.
The hybrid approach is taken a step further by cross-compiling SDKs such as Appcelerator Titanium, which provide a complete mobile OS abstraction platform, and translate JavaScript source code into actual native code (as opposed to rendering it in a web view). Such cross-compiled applications are not really web applications, as the JavaScript-based API is in fact used to create native UI components, with no HTML and CSS. Even more, other SDKs exist that adopt different languages as source code (e.g. MoSync also allows C and C++).
And finally we have native apps, built on the specific APIs of the target mobile operating system. Unfortunately each platform requires its own development language and tools (e.g. Objective-C on iOS, and Java on Android) and corresponding developers skills. As code reuse across different platforms is not possible, an app has to be developed for each individual system, at the cost of increased effort and harder manageability.
Understanding decision criteria
When facing choices for multiplatform mobile development you should not decide which is the best technology per se, as there is no general answer to that. Focus instead on understanding the peculiarities of your app and establish a mobile development strategy that satisfies multiple criteria in terms of functionality, business model and context. Which device software and hardware capabilities does your app need to access? What are the non-functional requirements (performance in particular)? How often do you plan to release updates? What is the monetization model (free, ads-supported, one-time-purchase, subscription etc.) and does it require the app to be in the app store? Also consider the context of your organization: what are your mobile development team skills? Are you willing to outsource development in case you cannot manage it internally? Answering those questions (and several more) will lead you to the selection of the most appropriate technology options for your needs.
Native apps maintain the edge as far as functionality and sheer power are concerned. They offer the fastest performance, familiar look and feel, full integration with the platform ecosystem, complete access to device software, and hardware features. Especially when it comes to highly interactive and animated user interfaces, they deliver a more effective user experience. HTML5 apps on the other hand are more limited in terms of functionality but they are a more cost effective approach to multiple platforms. Als,o HTML5 yields higher flexibility when it comes to distribution and monetization. Want to be in the official application store? Then package your app with the hybrid approach. Want to escape the official application store (and its rules and barriers and due royalties) instead? Then go for your own application provision strategy in the open web.
When going for multiplatform solutions bear in mind that while the idea of a common codebase is desirable the “write-once-run-anywhere” paradigm is ultimately an illusion, as your app will still need platform-dependent tweaks, and a broad QA effort. This is a design as well technical matter: each mobile OS comes with its peculiar interaction model (e.g. think of how the “back” action is presented differently in iOS and Android), and your application should be consistent with that in order to meet users’ expectations, unless its brand is so powerful as to allow the superimposition of a completely custom interaction model.
Last but not least, consider the time horizon. Native platforms come and go with turbulences in the mobile device market, whereas HTML (an open, vendor-independent technology) has been there for over 20 years and is here to stay for another long while. HTML5 is now enjoying widespread support on desktop, mobile and smart TV platforms; its specification is expected to reach W3C recommendation level by 2014, yielding even broader stability and interoperability. A new generation of mobile devices will come with increased computational and graphical power: Faster and more compatible mobile browsers will thus reduce the performance gap with native and provide stronger support to HTML5. And strong support will come from the software engineers community too, as HTML5 has enabled a whole generation of web developers to transfer their skills into the mobile world.
Alex Conconi is a software architect at frog's Milan studio.
Thu 14 Mar 2013
-
11:31 am
There are tools, and there are platforms. Tools tend to be simple things. They help you get some particular task done — they lend you their power when you need it — but they otherwise pretty much stay out of your life. They’re like little amplifiers of the self. Platforms are more complicated. They may help you do some of the same things that tools help you do, but, in granting that assistance, they demand that you become entangled in a bigger scheme, a scheme of someone else’s devising. Rarely do you know fully what the scheme consists of, what its ends are, or how it will develop in the future. A tool holds no secrets; a platform holds many. You use a tool; a platform uses you.
RSS is a good tool. It gives you a simple way to shape and filter the web’s content to suit your own needs. It lends you its power when you need it without requiring any broader entanglement. Its developers, to their credit, made its simplicity central. They were acting as tool-makers, which is how software programmers and web developers tended to act a decade ago. That was before the platform-builders arrived, with their schemes.
Google was once a tool-maker. Now, it’s a platform-builder. Like Facebook. Like Apple. Like Microsoft. Like Twitter. Like all the rest. And so Google is officially killing off its popular RSS tool Google Reader. The move was in the cards ever since the creation of the Google+ platform. Tools are threats to platforms because they give their owners ways to bypass platforms. If you have a good set of tools, you don’t need a stinking platform. If you’re happy with RSS, you’re a little less likely to sign up for Google+, or Twitter, or Facebook. At the very least, the tool gives you the choice. It grants you self-determination.
RSS, like other web tools and even other personal-computer tools, is doomed—not doomed, necessarily, to disappear, but doomed to be on the periphery, largely out of sight. “We’re living in a new kind of computing environment,” said Google engineer Urs Hölzle in announcing the “closure” of Google Reader. He’s right. The tool environment is gone. The platform environment is here. Consider yourself entangled.
Photo by Julia Manzerova.
Wed 13 Mar 2013
-
10:31 am

There are currently 70 new Drupal contributors awaiting review of their first project. This is a great place to contribute to the community and learn about interesting upcoming projects, for example...
Module: Drupalmonitor Connector
What does it do?
Do you maintain a large number of Drupal sites? Want to monitor all of them in a single dashboard? Check out Drupalmonitor.com!
This site offers a monitoring service that provides real-time usage statistics as well as other Drupal statistics like the total number of nodes on the site, any needed module or core updates, and more.The Drupalmonitor Connector module connects your Drupal site to drupalmonitor.com. Apparently the module has been available on drupalmonitor.com for a while, but the author has chosen to release it to the Drupal.org community.
Look Useful? Review it!
If this sounds like something you'd like to see readily available on Drupal.org, you should review it and help make that happen.
Pro Tip: If you've never reviewed a project application before, you can find instructions for reviewers on Drupal.org and the Code Review group is happy to help more people get involved.
Wed 06 Feb 2013
-
05:28 am
Tue 05 Feb 2013
-
05:28 pm
If you’ve been around the IT business a couple of decades, I’m sure you also remember what happened whenever Microsoft released a new Office version. They received a storm of user complaints! It was about the same thing every time: Microsoft had focused on adding shiny new features while neglecting to fix the existing ones. For every version office simply became more and more bloated.
-
02:28 pm
Everyone does it.
There’s a piece of JavaScript that will only be used on one page, perhaps to provide some unique interactivity. It’s probably attached to a View or maybe a unique node ID. It’s so easy to toss in a
drupal_add_js()and move on — or worse, throw the code in your theme. Wouldn’t it be nice if you could inline all these one-use scripts and make them appear only the page they’re needed?Inline on the Fly
Here’s an easy way to inline scripts without losing the ability to edit them easily. We don’t want our code sitting in a PHP string so we create and maintain a real JS file, and use file_get_contents() to grab it whenever the appropriate page is built.
// Ensure this JS ends up inline at the bottom of the page
$options = array(
'scope' => 'footer',
'type' => 'inline',
);
// JS lives in its own file but is included inline when page renders
$js_code = file_get_contents(drupal_get_path('module','my_module').'/my_code.js');
// Add JS to page
drupal_add_js($js_code, $options);Optimized pages + organized code
I often find myself using
hook_views_post_build()to apply this behavior when a specific Views display needs some custom JS to function properly. That way I don’t have to worry about the path, it just works anytime this View is used.Avid Features users know it’s much more maintainable to keep the JS in its own file next to the View instead of stuffing it in a Views footer, or worse: tossing vital code for components into the theme’s “main” (read: only) JS file. Putting code in a theme file can seem swell until you copy a Feature for use in another project and just can’t figure out where that JavaScript went.
/**
* Implements hook_views_post_build().
*/
function my_feature_views_post_build(&$view) {
$has_run = &drupal_static(__FUNCTION__);
if (!$has_run) {
switch ($view->name) {
// Check for the relevant View(s)
case 'my_view':
// Check for the relevant display(s)
if ($view->current_display == 'my_block') {
// Ensure this JS ends up inline at the bottom of the page
$options = array(
'scope' => 'footer',
'type' => 'inline',
);
// JS lives in its own file but is included inline when page renders
$js_code = file_get_contents(drupal_get_path('module','my_feature').'/my_code.js');
// Add JS to page
drupal_add_js($js_code, $options);
}
break;
}
}
}Performance
While this avoids an http request and is great for frontend performance, if you have a page that is uncached and hit continuously, adding disk reads won’t be so great for the actual server’s performance. You can see in the second example there’s a reference to
drupal_static(). This is a good way to avoid running a slow Drupal hook more than once per page request. Always make sure to cache the outcome of functions like this one in order to avoid too many disk reads.
Mon 04 Feb 2013
-
09:28 am
Web site redesigns originate for unique reasons, but fundamentally they fall into two distinct categories: the right and the wrong.
Working early in my career for the joint venture of CNN and Sports Illustrated, cnnsi.com, I was on a team that led several redesigns. Why several? The executive leadership changed frequently, to the point that we could set our watches to the timing of a new redesign starting upon arrival of the next President or Managing Editor. A classic example of redesigning for the wrong reasons -- because some executive needed to put their stamp on the site like a dog marking its front yard.

