SlideShare a Scribd company logo
©2015 Couchbase Inc. 1
Nic Raboy, Developer Advocate at Couchbase
Developing For Offline First Mobile
Experiences
©2015 Couchbase Inc. 2
About Me
Nic Raboy
Developer Advocate at Couchbase
nic@couchbase.com
@nraboy (Twitter)
©2015 Couchbase Inc. 3
The Plan
 Where are things headed
 The business problem
 Couchbase Mobile
 Example native code
 Example hybrid code
©2015 Couchbase Inc. 4
Current State
©2015 Couchbase Inc. 5
Trends
©2015 Couchbase Inc. 6
RDBMS
©2015 Couchbase Inc. 7
NoSQL
What is the business problem?
Today’s Mobile Apps
9
Try again
later.
No Internet
please wait…
©2015 Couchbase Inc. 10
How DoesThis Affect What PeopleThink?
Doesn’t work a lot of the time and when
it does it’s slow.
©2015 Couchbase Inc. 11
How DoesThis Affect App Uninstall Rates?
0%
20%
40%
60%
80%
100%
UninstallRate
Freezing
Crashing
Slow Responsiveness
Source: uSamp
Data Location is the Problem
12
Local Data + Sync is the Solution
13
©2015 Couchbase Inc. 14
What DoesThis Mean ForYour Apps
Always work both online & offline
Always be blazing fast
Built with orders of magnitude less code
Users will absolutely love your apps
What is Couchbase Mobile?
Couchbase Lite Sync Gateway
©2015 Couchbase Inc. 17
Couchbase Lite
• NoSQL Mobile Database
• Document Oriented & Schema-Less
• Small Footprint
• Runs In-Process
©2015 Couchbase Inc. 18
Couchbase Sync Gateway
• Data Replication Between Server & Device
• Data Orchestration
• Authentication & Authorization
©2015 Couchbase Inc. 19
Replication
 Is asynchronous
 Can be continuous or one-shot
 Sends JSON over HTTP
 Handles network hiccups
 Network timeouts
©2015 Couchbase Inc. 20
Channels
Sports San Francisco
Nature
Admin
21
©2015 Couchbase Inc. 22
Available SDKs & Frameworks
©2015 Couchbase Inc. 23
Couchbase Mobile Summary
 Offline first approach
 NoSQL document database
 Works with Couchbase Server
 Available for many platforms and frameworks
Couchbase Lite for Native Android & iOS
©2015 Couchbase Inc. 25
Creating a Database
©2015 Couchbase Inc. 26
Inserting a Document
©2015 Couchbase Inc. 27
Couchbase LiteViews
©2015 Couchbase Inc. 28
Map / Reduce Views
 Concept from functional program, via Google
 App-defined map function operates on documents
 Function output generates an index ordered by key
 Index rows can be aggregated via a reduce function
 Index is queried by a key or key range
©2015 Couchbase Inc. 29
Replication With Sync Gateway
©2015 Couchbase Inc. 30
Listen For Changes
©2015 Couchbase Inc. 31
Other WaysTo Listen
 DatabaseChanged:Any document updated
 DocumentChanged: A specific document updated
 LiveQuery: Change in query result set
©2015 Couchbase Inc. 32
Couchbase Lite for iOS Special Note
 iOS SDK works for OS X desktop applications
Couchbase Cordova Plugin
©2015 Couchbase Inc. 34
Couchbase Cordova Plugin
 Compatible with Android and iOS
 Access Couchbase Lite via RESTful APIs
 Easily integrate with Ionic Framework and PhoneGap
through the ng-couchbase-lite wrapper
©2015 Couchbase Inc. 35
Creating a Database
©2015 Couchbase Inc. 36
Inserting Documents
©2015 Couchbase Inc. 37
Couchbase LiteViews
©2015 Couchbase Inc. 38
Querying CouchbaseViews
©2015 Couchbase Inc. 39
Replication With Sync Gateway
©2015 Couchbase Inc. 40
Listen for Changes
Couchbase Sync Gateway
©2015 Couchbase Inc. 42
Basic Sync Gateway Configuration
Creating a Native AndroidToDo List
©2015 Couchbase Inc. 44
Couchbase MobileToDo List Application
©2015 Couchbase Inc. 45
Code Walkthrough!
 Creating the UI
 Initializing the Android ListView
 Designing the Android ListView
 Creating a database and replicating with the server
 Listening for database changes
 Adding data to the database
 Removing data from the database
 Cleaning up when terminating the application
DemoTime!
©2015 Couchbase Inc. 47
Couchbase Labs on GitHub
https://github.com/couchbaselabs/todolite-android
https://github.com/couchbaselabs/todolite-ios
https://github.com/couchbaselabs/todolite-ionic
Questions?
©2014 Couchbase, Inc.
©2015 Couchbase Inc. 49
We’re Hiring!
http://www.couchbase.com/careers
©2015 Couchbase Inc. 50
ThankYou!
Nic Raboy
nic@couchbase.com
@nraboy (Twitter)

More Related Content

PPTX
Journey to The Cloud-Native Enterprise
PPTX
What is DevOps?
PPTX
Evan Kaplan [InfluxData] | InfluxDays Opening Remarks | InfluxDays Virtual Ex...
PDF
O365Engage17 - Extending power apps and microsoft flow with custom code
PDF
How to drive more value from Innovation Initiatives
PDF
Pivotal Journeys
PPTX
Lean Kanban India 2015 | Implementing Scaled Kanban by Stealth: A Case Study ...
PPTX
Build Enterprise Level Solution using Logic Apps ,Functions and Graph API
Journey to The Cloud-Native Enterprise
What is DevOps?
Evan Kaplan [InfluxData] | InfluxDays Opening Remarks | InfluxDays Virtual Ex...
O365Engage17 - Extending power apps and microsoft flow with custom code
How to drive more value from Innovation Initiatives
Pivotal Journeys
Lean Kanban India 2015 | Implementing Scaled Kanban by Stealth: A Case Study ...
Build Enterprise Level Solution using Logic Apps ,Functions and Graph API

What's hot (20)

PDF
Wolters Kluwer Tech. Conference: Disrupting Mobile Development
PDF
Building an Experiment Pipeline for GitHub’s New Free Team Offering
PPTX
Idc Nebuloni Digitale Software Entwicklung - Roadshow Munich/Frankfurt
POTX
Implications and future of Conversation as a Platform (CaaP)
PDF
Becoming Product-Centric
POTX
Event Report - Microsoft Build 2016 - All about building next generation appl...
PPTX
HDF Product Designer Desktop
PDF
Michael Hall [InfluxData] | InfluxDB Community Update | InfluxDays NA 2021
PDF
Making shiny shine brighter
PDF
Gliffy in Atlassian
PDF
Migrating from angular to react
PPTX
Experience in Magento Community Projects
PDF
Application Archaeology: Accelerating App Modernization at DICK’S Sporting Goods
PPTX
The Web in ABB, how we went Agile and why we love it
PPTX
Competing with Software: It Takes a Platform -- Devops @ EMC World
PPTX
Chronicle presentation - Dean
PPTX
QuickBooks Connect 2016 - Using WebHooks to handle data changes in your app
PDF
EECS 497 Intro
PDF
Netbiscuits camerjam mobile brand masterclass
PPT
Fishbowl Opc.Com Presentation
Wolters Kluwer Tech. Conference: Disrupting Mobile Development
Building an Experiment Pipeline for GitHub’s New Free Team Offering
Idc Nebuloni Digitale Software Entwicklung - Roadshow Munich/Frankfurt
Implications and future of Conversation as a Platform (CaaP)
Becoming Product-Centric
Event Report - Microsoft Build 2016 - All about building next generation appl...
HDF Product Designer Desktop
Michael Hall [InfluxData] | InfluxDB Community Update | InfluxDays NA 2021
Making shiny shine brighter
Gliffy in Atlassian
Migrating from angular to react
Experience in Magento Community Projects
Application Archaeology: Accelerating App Modernization at DICK’S Sporting Goods
The Web in ABB, how we went Agile and why we love it
Competing with Software: It Takes a Platform -- Devops @ EMC World
Chronicle presentation - Dean
QuickBooks Connect 2016 - Using WebHooks to handle data changes in your app
EECS 497 Intro
Netbiscuits camerjam mobile brand masterclass
Fishbowl Opc.Com Presentation
Ad

Viewers also liked (13)

PDF
Outlook
PPTX
Bedrijfsprofiel Van Dryhouse België
DOCX
Semester 2 writen Report
PPT
Global warming
PPTX
Institutions
PDF
Sweet Cupcakes
DOC
Báo cáo thực tập
PPTX
Schedule
PPTX
Package deal
PDF
Experimente la analitica en tiempo real con las IBM Storage Solutions
DOCX
2016年2月14日sake活洋酒担当ご挨拶チラシ
PDF
Oze przewodnik
PPSX
Introduction power point
Outlook
Bedrijfsprofiel Van Dryhouse België
Semester 2 writen Report
Global warming
Institutions
Sweet Cupcakes
Báo cáo thực tập
Schedule
Package deal
Experimente la analitica en tiempo real con las IBM Storage Solutions
2016年2月14日sake活洋酒担当ご挨拶チラシ
Oze przewodnik
Introduction power point
Ad

Similar to Developing for Offline First Mobile Experiences (20)

PPTX
Cross Platform Storage & Sync with Couchbase and Ionic Framework
PPTX
Beacon talk
PDF
NoSQL - Vital Open Source Ingredient for Modern Success
PDF
NoSQL, the Vital Open Source Ingredient for Modern Success
PDF
How to Architect and Develop Cloud Native Applications
PDF
Cloud native pitch-younjin-20150925-v2
PDF
Pivotal spring boot-cloud workshop
PPTX
GitOps and Its tools.pptx
PPTX
GitOps and Its tools.pptx
PDF
Using ChatOps In An Open And Conversational Workflow
PPTX
Pivotal Cloud Platform Roadshow Keynote
PPTX
INF104 - HCL Domino AppDev Pack – The Future of Domino App Dev Nobody Knows A...
PPTX
Office Add-ins community call-March 2019
PPTX
Bringing Pull Request to Gerrit
PPTX
Anypoint platform in a mobile-centric world
PDF
Intalio create and cloudfoudry - short
PDF
Enterprise software needs a PaaS
PDF
Enterprise DevOps Series: Using VS Code & Zowe
PDF
How NBCUniversal Adopted DevOps
PDF
Making the Dinosaur Dance - RDz, RTC and UrbanCode Lunch and Learn slides
Cross Platform Storage & Sync with Couchbase and Ionic Framework
Beacon talk
NoSQL - Vital Open Source Ingredient for Modern Success
NoSQL, the Vital Open Source Ingredient for Modern Success
How to Architect and Develop Cloud Native Applications
Cloud native pitch-younjin-20150925-v2
Pivotal spring boot-cloud workshop
GitOps and Its tools.pptx
GitOps and Its tools.pptx
Using ChatOps In An Open And Conversational Workflow
Pivotal Cloud Platform Roadshow Keynote
INF104 - HCL Domino AppDev Pack – The Future of Domino App Dev Nobody Knows A...
Office Add-ins community call-March 2019
Bringing Pull Request to Gerrit
Anypoint platform in a mobile-centric world
Intalio create and cloudfoudry - short
Enterprise software needs a PaaS
Enterprise DevOps Series: Using VS Code & Zowe
How NBCUniversal Adopted DevOps
Making the Dinosaur Dance - RDz, RTC and UrbanCode Lunch and Learn slides

More from Nic Raboy (10)

PPTX
Getting Started with MongoDB using Node.js
PPTX
Marketing and Workflow Automation
PPTX
Create a Chatbot with AWS Lex, Lambda, and HERE
PPTX
Developing Amazon Alexa Skills with the Go Programming Language
PPTX
Static Site Generation with Hugo and Markdown
PPTX
Powering an API with GraphQL, Golang, and NoSQL
PPTX
Building a Bitcoin Hardware Wallet with Golang and a Raspberry Pi Zero
PPTX
Developing Applications with Go and NoSQL
PPTX
Native to Hybrid and Back Again
PPTX
Quick and Easy Development with Node.js and Couchbase Server
Getting Started with MongoDB using Node.js
Marketing and Workflow Automation
Create a Chatbot with AWS Lex, Lambda, and HERE
Developing Amazon Alexa Skills with the Go Programming Language
Static Site Generation with Hugo and Markdown
Powering an API with GraphQL, Golang, and NoSQL
Building a Bitcoin Hardware Wallet with Golang and a Raspberry Pi Zero
Developing Applications with Go and NoSQL
Native to Hybrid and Back Again
Quick and Easy Development with Node.js and Couchbase Server

Recently uploaded (6)

DOC
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
PDF
heheheueueyeyeyegehehehhehshMedia-Literacy.pdf
PPTX
ASMS Telecommunication company Profile
DOC
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
PDF
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
PDF
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
heheheueueyeyeyegehehehhehshMedia-Literacy.pdf
ASMS Telecommunication company Profile
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf

Developing for Offline First Mobile Experiences

Editor's Notes

  • #9: Before we begin, I want to take some time to share with you why we created Couchbase mobile, and the business problem that we hoped to solve.
  • #10: Today’s Mobile Apps ---- Most of today’s mobile apps are designed so that any remote data, whether downloading records from a server or uploading your local data, requires the network to be available and online. As long as that’s the case, and the Internet connection is fast enough, and there aren’t any problems, then the app performs exactly as expected—and that’s great. But as soon as the network begins to degrade, say we’re down to just a couple of tower bars, or the Wi-F is having a bunch of latency—that sort of thing—then we start to see the app’s user experience break down. That’s when we see the progress notification UI hints show up, the spinners, the waiting. If things get bad enough, we will see an error message saying that, “I’m sorry you can’t do what you were trying to do right now, you’ll have to try later.” Whatever work you were doing is lost, and the end result is a user who is unhappy and dissatisfied and can use your app.
  • #11: How Does This Affect What People Think? ---- how do you know if you’ve got these kind of problems? Well, it’s reflected in your app store rating. We’ve all seen apps in the one and two star category, with user reviews saying that the app doesn’t work or it’s slow.
  • #12: How Does This Affect App Uninstall Rates ---- Besides the bad brand PR, why should you care? Because people delete poorly performing apps. Let’s look at application uninstall rates. Why do people delete an app from their device? The top three reasons are: freezing, crashing, and slow responsiveness. And in the case of freezing and slow responsiveness, those are directly tied to how we build our application. More often than not, our networking code is the culprit. In a lot of cases we can’t control the environment where people are using our app, but if we’re using proper coding strategies, we can mitigate those issues.
  • #13: Slide 10 - Data Location is the Problem
  • #14: Slide 11 - Local Data + Sync is the Solution
  • #17: We have two core products in Couchbase mobile. We have Couchbase Lite, which runs on the device And we have Sync Gateway, which stands on the border between your private cloud and the public cloud.
  • #18: We have two core products in Couchbase mobile. We have Couchbase Lite, which runs on the device And we have Sync Gateway, which stands on the border between your private cloud and the public cloud.
  • #22: Sync gateway also handles the permanent persistence of your applications data in your Couchbase Server cluster that lives in your private data center. So as your device is syncing with sync gateway and pushing your data up, sync gateway is also writing that data into the permanent data store, backed by our highly scalable Couchbase Server technology. Now, let’s look at security layer concerns: in this particular case, authorization.
  • #36: Creating a Database ---- cblite.getURL is the only available plugin function. Use the URL to create a new ng-couchbase-lite object and assign it a database name. All requests will go against this URL and database including the “createDatabase” function.
  • #37: Inserting Documents ---- Show that you can take a JavaScript object and insert it directly into Couchbase Lite without any further manipulations. Database transactions return promises to remain asynchronous.
  • #38: Couchbase Lite Views ---- Elaborate the differences between HTML5 local storage and NoSQL. With HTML5 local storage you’re probably going to serialize all data into a single property. This single property is going to become quite large and hard to maintain, but you’re going to do your lookups with that one key name that you probably remember. With NoSQL documents you’re going to have many documents which you probably won’t remember the key names for. To get all these documents you’re going to need to design a view for querying them. In the case of the Todo Lite example, there are two views. A view for querying lists and a view for querying the tasks that exist in a list.
  • #39: Querying Couchbase Views ---- Querying the “lists” view will return all lists, but of course in a promise to remain asynchronous. You also have the option to pass a start key, which is obvious in the example of querying the “tasks” view. You don’t want to query all the tasks, only the particular tasks that go with a list.
  • #40: Replication With Sync Gateway ---- When replication starts, it will asynchronously happen in the background. In this example, replication will continuously happen, pushing all local changes to the sync gateway. Once local starts replicating up, we also replicate the sync gateway down to local. We are starting two replication processes.
  • #41: Listen for Changes ---- The “listen()” function of ng-couchbase-lite will broadcast any changes it picks up by doing continuous long-polls against the API. Changes include those done locally and remotely. Anything broadcasted can be picked up in AngularJS with the “$on” method of “$rootScope”. Broadcasted information is in array form with properties that contain ID and “possibly” a deleted property to signify that a document has been deleted
  • #44: Demo Time ---- Sync Gateway URL: http://localhost:4985/_admin/ Simulator IP: 192.168.56.1 Sync Gateway Port: 4984
  • #48: Couchbase Labs on GitHub ---- A fully functional example project is available for download on GitHub.