Newsletters




An Offline-First Approach Keeps Applications Connected


Building applications can already be a grueling process for developers, especially when networks become slow, spotty, or go down completely.  By building offline-first apps, developers create an always-on experience for their users. An offline-first app is one that works, without error, when there is no network connection, with progressive enhancement applied whenever network connectivity is available.

In a recent DBTA webcast, Bradley Holt, IBM developer advocate, discussed how offline-first apps built with Apache CouchDB and PouchDB (an open source JavaScript database) can provide a better, faster user experience by storing data locally and then synchronizing with a cloud database when a network connection is available.

As developers dive into making apps, Holt notes sometimes they believe in the “The Eight Fallacies of Distributed Computing” which includes:  the network is reliable, latency is zero, bandwidth is infinite, the network is secure, topology doesn't change, there is one administrator, transport cost is zero, and the network is homogeneous.

“Connectivity is an assumed baseline of which can enhance,” Holt said.

There are two options to approach building apps offline, graceful degradation and progressive enhancement. With the graceful degradation approach developers build their app as usual, assuming they have internet connection and then when the network is lost, errors get handled.

The progressive enhancement route involves assuming the application won’t have a network connection, but once it’s able to connect to the internet the app gets “enhanced” by the connection.

“Don’t assume that lack of connectivity is an error condition,” Holt said. “Build your app to work without a connection so that you can get updated content, sync your data, or enable features that aren’t practical to work offline when it gets connected. Let your users still interact with your app when an online connection isn’t available.”

He introduced attendees to several tools that can build mobile apps offline including Cloudant Sync, CouchDB, and more.

To view this webcast, go here.


Sponsors