Couchbase Mobile Ideathon 
Traun Leyden 
Lead Android Developer 
tleyden@couchbase.com 
10/29/13
About me 
• I was previously at a startup company doing a 
mobile CRM app — we converted our app to 
Couchbase Lite to solve networking performance 
issues 
• Now I work full time as the lead developer on 
Couchbase Lite Android 
• I also work on demo apps on both iOS and Android 
• I have blog at http://tleyden.github.io
About Couchbase 
• Was the merger of two companies 
• CouchOne (commercial support for CouchDB) 
• Membase (a commercially supported / distributed 
version of memcached) 
• Our flagship product is Couchbase Server, a fault 
tolerant distributed database. 
• We recently released Couchbase Mobile, targeted 
towards mobile and embedded devices/sensors. 
• All of our products are released as Open Source 
software under the Apache2 license. 
• We now have an office in Japan
Why would you want to use 
Couchbase Mobile? 
Will your app work when the network is 
slow or only sometimes connected? 
?
We think our network is fast, but .. 
• On trains or underground 
• Large crowds 
• Out of the city center 
• Deployed on sites which have unreliable 
Wifi 
• Sometimes you are completely offline 
• Etc ..
The simplest use case — sending a 
tweet on the subway 
Users expect better than this!
Our solution - Sync
Your app reads/writes to a local 
database 
This will be fast even if the network is slow or offline
Couchbase Lite sync’s the data to the 
cloud (can run in background)
TodoLite Demo 
• TodoLite is a todo list app 
• Users can login via Facebook 
• Users can share todo lists with each 
other 
• Different users can both view and 
update the same list 
• Photo attachments can be added to 
Todo items 
• Supports conflict resolution 
• Source code available on github (see 
resources slide) 
• Available in iTunes app store and 
Google Play
Understanding sync gateway 
• Sync Gateway can control which 
users can see which documents. 
• In effect, it can partition the 
database so that users only see a 
subset of the database
Partitioning a database by company 
and region
Using Sync Gateway to partition a 
database 
• Sync Gateway can do this efficiently 
• The main reason it was created 
• Sync Gateway uses “channels” to do 
this 
• Let’s walk through an example
Using Channels in 
OfficeRadar Example 
OfficeRadar uses iBeacons to detect who is in the office
Users should only see activity for other 
users in their organization
Sync Function 
• The sync function partitions the database by 
putting documents into channels 
• To understand the sync function, we must 
look at the OfficeRadar documents
OfficeRadar GeofenceEvent Document 
Each Geofence Event is associated with an 
organization 
{ 
"_id":"!QJoBU7cRa~m2E2tYloSHHN", 
"_rev":"1-8e8f3cebf357a2546c0d40e497227115", 
"action":"entry", 
"beacon":"4a83813db6ce76e9618793cf483cfa10", 
"created_at":"2014-08-28T23:43:19.119Z", 
"userprofile":"10152586863333982", 
"type":"geofence_event", 
"organization":"couchbase" 
}
OfficeRadar UserProfile Document 
Each User Profile is associated with an 
organization 
{ 
"_id":"10152586863333982", 
"_rev":"1-2b6a6e182ef77cd15db7171023931e8d", 
"type":"profile", 
"authSystem":"facebook", 
"name":"Traun Leyden", 
"organization":"couchbase" 
}
OfficeRadar Sync Function 
function(doc, oldDoc) { 
if (doc.type == "geofence_event") { 
channel(doc.organization); 
} else if (doc.type == "profile") { 
access(doc.userid, doc.organization); 
} 
}
Adding a geofence event to a channel 
if (doc.type == "geofence_event") { 
channel(doc.organization); 
}
Allowing a user to access an 
organization’s channel 
else if (doc.type == "profile") { 
access(doc.userid, doc.organization); 
}
Views 
Putting the “No” in NoSQL 
• Map/Reduce mechanism 
- A standard method of indexing in NoSQL 
- A view is similar to index in relational database. 
• App-defined map function 
- Called on every document 
- Can emit arbitrary key/value pairs into the index 
• Optional reduce function 
- Data aggregation / grouping 
• Functions are registered as native callbacks 
- Native callbacks make sense for performance and to match the rest of 
the app codebase
Queries 
• Basic feature set 
- Key ranges, offset/limit, reverse, group by key… 
- No joins or fancy sorting 
- but compound keys (and clever emits) allow for some tricks 
• LiveQuery subclass 
- Monitors a view for changes 
- Can think of it as a “pub-sub” approach 
- Register a callback that is triggered when the query changes
Use Cases
Embedded 
Picsolve 
 Image capture of roller 
coaster riders to local 
database in multiple 
theme park locations 
 Machine to machine 
communication example 
 Unreliable network 
connectivity required 
offline capture / later sync 
to centralized 
management system
Infinite Campus 
Education / Social Interaction 
 Selectively push out learning 
modules / multimedia lessons 
to individual students 
 Teachers and students use 
custom mobile chat apps for 
real-time Q&A during lectures 
 Homework assignments can be 
completed offline anywhere
Offline Sensor Data 
A weather balloon could collect sensor data while 
offline and sync it whenever it is online
Travel Expense Tracker 
• I am in Tokyo, but my iPhone 5 is locked so I cannot use a 
local SIM card. 
• But I need an app to track my expenses, so I must be able to 
enter expenses while offline. 
• When I get back to the US, I want to sync these expenses to 
the Cloud so I can download a spreadsheet.
Resources 
• These slides will be made available on SlideShare 
• Sample code links 
• https://github.com/couchbaselabs/ToDoLite-Android 
• https://github.com/couchbaselabs/ToDoLite-iOS 
• https://github.com/tleyden/office-radar 
• Documentation 
• http://developer.couchbase.com/mobile 
• Download 
- http://mobile.couchbase.com 
• Contact: couchbasejp@couchbase.com
Resources 2 
• Couchbase Mobile Google Group (community): 
groups.google.com/group/mobile-couchbase/ 
• Couchbase Mobile Twitter: 
https://twitter.com/CouchbaseMobile 
• Run Sync Gateway (and Couchbase Server!) under Docker: 
http://tleyden.github.io/blog/2014/06/22/running-couchbase- 
sync-gateway-on-gce/
Upcoming Event: Hackathon 
• http://couchbasejpcommunity.doorkeeper.jp/events/13988
Upcoming Event: 
Couchbase Server 
• Couchbase Server 
http://couchbasejpcommunity.doorkeeper.jp/events/14785
Thanks for watching! 
Contact: tleyden@couchbase.com 
Questions?

More Related Content

PPTX
Dnug2012 yellow and blue stream
PPTX
Denver Salesforce Developer User Group dec 2016 lightning components
PDF
Citizen Developer Tools (session at SharePoint Saturday Houston 4/28/2018) by...
PPTX
SharePoint 2013, Office 365 and Social Compliance
PDF
Citizen Developer Tools @ Valo Solutions / Blue Meteorite Monday session
PPTX
Citizen Developer Tools are not just for Citizen Developers (session at Share...
PPTX
React.js at Cortex
PPTX
Office add ins community call - april 2019
Dnug2012 yellow and blue stream
Denver Salesforce Developer User Group dec 2016 lightning components
Citizen Developer Tools (session at SharePoint Saturday Houston 4/28/2018) by...
SharePoint 2013, Office 365 and Social Compliance
Citizen Developer Tools @ Valo Solutions / Blue Meteorite Monday session
Citizen Developer Tools are not just for Citizen Developers (session at Share...
React.js at Cortex
Office add ins community call - april 2019

What's hot (20)

PDF
Citizen Developer Tools (session at SharePoint Saturday Twin Cities 4/14/2018...
PDF
Citizen Developer Tools - session at SPS New England 10/20/2018
PDF
Riding the Edge with Ember.js
PDF
CUST-12 What’s New in Share Extras
PDF
CUST-13 What’s New in Share Extras
PPTX
Making Articles Easier: Implementing OCLC Knowledge Base for Direct Requestin...
PPTX
Intro to PowerApps and Flow
PPTX
Powering Up SharePoint Forms with PowerApps
PDF
Full trust code is not dead
PPTX
How to build SharePoint 2013 Killer Apps
PPTX
Powering the Modern Classroom with PowerApps & PowerBI
PDF
aOS Moscow - E3 - Integrate the Power Platform with SharePoint
PPTX
Part1 saintsfinal
PPTX
Part1saintsfinal
PPTX
Building Social Business Applications with OpenSocial
PPTX
Next Level PowerApps
PDF
aOS Moscow - E4 - PowerApps for enterprise developers - Fabio Franzini
PPTX
Dashboarding with Microsoft: Datazen & Power BI
PDF
Next Level PowerApps SPS St Louis
PPTX
Tar tablet september 2013
Citizen Developer Tools (session at SharePoint Saturday Twin Cities 4/14/2018...
Citizen Developer Tools - session at SPS New England 10/20/2018
Riding the Edge with Ember.js
CUST-12 What’s New in Share Extras
CUST-13 What’s New in Share Extras
Making Articles Easier: Implementing OCLC Knowledge Base for Direct Requestin...
Intro to PowerApps and Flow
Powering Up SharePoint Forms with PowerApps
Full trust code is not dead
How to build SharePoint 2013 Killer Apps
Powering the Modern Classroom with PowerApps & PowerBI
aOS Moscow - E3 - Integrate the Power Platform with SharePoint
Part1 saintsfinal
Part1saintsfinal
Building Social Business Applications with OpenSocial
Next Level PowerApps
aOS Moscow - E4 - PowerApps for enterprise developers - Fabio Franzini
Dashboarding with Microsoft: Datazen & Power BI
Next Level PowerApps SPS St Louis
Tar tablet september 2013
Ad

Viewers also liked (6)

PDF
I "love" Shares
PPTX
Ideathon HK
PDF
Ideathon Overview 2016 - participants
KEY
20110619 live view ideathon_logcatonliveview
KEY
Space Apps Challenge Ideathon Presentation
PPTX
2016 Ideathon Big Data Introduction
I "love" Shares
Ideathon HK
Ideathon Overview 2016 - participants
20110619 live view ideathon_logcatonliveview
Space Apps Challenge Ideathon Presentation
2016 Ideathon Big Data Introduction
Ad

Similar to Couchbase Mobile Ideathon in Tokyo 2014.08.29: Developing with couchbase lite (20)

PDF
Couchbase Mobile on Android
PPTX
Data sync on iOS with Couchbase Mobile
PPTX
Developing for Offline First Mobile Experiences
PDF
From 0 to syncing
PPTX
Cross Platform Storage & Sync with Couchbase and Ionic Framework
PPTX
Couchbase Chennai Meetup 2 - Couchbase - Mobile
PDF
Grokking TechTalk 9 - Building a realtime & offline editing service from scra...
PDF
Offline first solutions highland web group - december 2015
PPTX
Cloudbase.io MoSync Reload Course
PDF
NoSQL on the move
PDF
CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)
PPTX
Herramientas para sacar el mayor rendimiento de tu app por Google
PDF
Grokking #9: Building a real-time and offline editing service with Couchbase
PPTX
Mobile App Development With IBM Cloudant
PDF
No sql data-storage for-your-ios-apps-using-couchbase-mobile
PDF
Couchbase Overview Nov 2013
PDF
Couchbase overview033113long
PDF
Couchbase overview033113long
PDF
iOSDevCamp Firebase Overview
PPTX
Tech Winter Break - GDG OnCampus International Institute of Information Techn...
Couchbase Mobile on Android
Data sync on iOS with Couchbase Mobile
Developing for Offline First Mobile Experiences
From 0 to syncing
Cross Platform Storage & Sync with Couchbase and Ionic Framework
Couchbase Chennai Meetup 2 - Couchbase - Mobile
Grokking TechTalk 9 - Building a realtime & offline editing service from scra...
Offline first solutions highland web group - december 2015
Cloudbase.io MoSync Reload Course
NoSQL on the move
CBDW2014 - NoSQL Development With Couchbase and ColdFusion (CFML)
Herramientas para sacar el mayor rendimiento de tu app por Google
Grokking #9: Building a real-time and offline editing service with Couchbase
Mobile App Development With IBM Cloudant
No sql data-storage for-your-ios-apps-using-couchbase-mobile
Couchbase Overview Nov 2013
Couchbase overview033113long
Couchbase overview033113long
iOSDevCamp Firebase Overview
Tech Winter Break - GDG OnCampus International Institute of Information Techn...

Recently uploaded (20)

PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
Modernising the Digital Integration Hub
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PPT
What is a Computer? Input Devices /output devices
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Architecture types and enterprise applications.pdf
PPTX
Benefits of Physical activity for teenagers.pptx
PPTX
Tartificialntelligence_presentation.pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Hybrid model detection and classification of lung cancer
PDF
Five Habits of High-Impact Board Members
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
August Patch Tuesday
PDF
Getting started with AI Agents and Multi-Agent Systems
Web Crawler for Trend Tracking Gen Z Insights.pptx
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Taming the Chaos: How to Turn Unstructured Data into Decisions
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Modernising the Digital Integration Hub
sustainability-14-14877-v2.pddhzftheheeeee
What is a Computer? Input Devices /output devices
A review of recent deep learning applications in wood surface defect identifi...
Architecture types and enterprise applications.pdf
Benefits of Physical activity for teenagers.pptx
Tartificialntelligence_presentation.pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Final SEM Unit 1 for mit wpu at pune .pptx
Enhancing emotion recognition model for a student engagement use case through...
Hybrid model detection and classification of lung cancer
Five Habits of High-Impact Board Members
Module 1.ppt Iot fundamentals and Architecture
WOOl fibre morphology and structure.pdf for textiles
August Patch Tuesday
Getting started with AI Agents and Multi-Agent Systems

Couchbase Mobile Ideathon in Tokyo 2014.08.29: Developing with couchbase lite

  • 1. Couchbase Mobile Ideathon Traun Leyden Lead Android Developer [email protected] 10/29/13
  • 2. About me • I was previously at a startup company doing a mobile CRM app — we converted our app to Couchbase Lite to solve networking performance issues • Now I work full time as the lead developer on Couchbase Lite Android • I also work on demo apps on both iOS and Android • I have blog at http://tleyden.github.io
  • 3. About Couchbase • Was the merger of two companies • CouchOne (commercial support for CouchDB) • Membase (a commercially supported / distributed version of memcached) • Our flagship product is Couchbase Server, a fault tolerant distributed database. • We recently released Couchbase Mobile, targeted towards mobile and embedded devices/sensors. • All of our products are released as Open Source software under the Apache2 license. • We now have an office in Japan
  • 4. Why would you want to use Couchbase Mobile? Will your app work when the network is slow or only sometimes connected? ?
  • 5. We think our network is fast, but .. • On trains or underground • Large crowds • Out of the city center • Deployed on sites which have unreliable Wifi • Sometimes you are completely offline • Etc ..
  • 6. The simplest use case — sending a tweet on the subway Users expect better than this!
  • 8. Your app reads/writes to a local database This will be fast even if the network is slow or offline
  • 9. Couchbase Lite sync’s the data to the cloud (can run in background)
  • 10. TodoLite Demo • TodoLite is a todo list app • Users can login via Facebook • Users can share todo lists with each other • Different users can both view and update the same list • Photo attachments can be added to Todo items • Supports conflict resolution • Source code available on github (see resources slide) • Available in iTunes app store and Google Play
  • 11. Understanding sync gateway • Sync Gateway can control which users can see which documents. • In effect, it can partition the database so that users only see a subset of the database
  • 12. Partitioning a database by company and region
  • 13. Using Sync Gateway to partition a database • Sync Gateway can do this efficiently • The main reason it was created • Sync Gateway uses “channels” to do this • Let’s walk through an example
  • 14. Using Channels in OfficeRadar Example OfficeRadar uses iBeacons to detect who is in the office
  • 15. Users should only see activity for other users in their organization
  • 16. Sync Function • The sync function partitions the database by putting documents into channels • To understand the sync function, we must look at the OfficeRadar documents
  • 17. OfficeRadar GeofenceEvent Document Each Geofence Event is associated with an organization { "_id":"!QJoBU7cRa~m2E2tYloSHHN", "_rev":"1-8e8f3cebf357a2546c0d40e497227115", "action":"entry", "beacon":"4a83813db6ce76e9618793cf483cfa10", "created_at":"2014-08-28T23:43:19.119Z", "userprofile":"10152586863333982", "type":"geofence_event", "organization":"couchbase" }
  • 18. OfficeRadar UserProfile Document Each User Profile is associated with an organization { "_id":"10152586863333982", "_rev":"1-2b6a6e182ef77cd15db7171023931e8d", "type":"profile", "authSystem":"facebook", "name":"Traun Leyden", "organization":"couchbase" }
  • 19. OfficeRadar Sync Function function(doc, oldDoc) { if (doc.type == "geofence_event") { channel(doc.organization); } else if (doc.type == "profile") { access(doc.userid, doc.organization); } }
  • 20. Adding a geofence event to a channel if (doc.type == "geofence_event") { channel(doc.organization); }
  • 21. Allowing a user to access an organization’s channel else if (doc.type == "profile") { access(doc.userid, doc.organization); }
  • 22. Views Putting the “No” in NoSQL • Map/Reduce mechanism - A standard method of indexing in NoSQL - A view is similar to index in relational database. • App-defined map function - Called on every document - Can emit arbitrary key/value pairs into the index • Optional reduce function - Data aggregation / grouping • Functions are registered as native callbacks - Native callbacks make sense for performance and to match the rest of the app codebase
  • 23. Queries • Basic feature set - Key ranges, offset/limit, reverse, group by key… - No joins or fancy sorting - but compound keys (and clever emits) allow for some tricks • LiveQuery subclass - Monitors a view for changes - Can think of it as a “pub-sub” approach - Register a callback that is triggered when the query changes
  • 25. Embedded Picsolve  Image capture of roller coaster riders to local database in multiple theme park locations  Machine to machine communication example  Unreliable network connectivity required offline capture / later sync to centralized management system
  • 26. Infinite Campus Education / Social Interaction  Selectively push out learning modules / multimedia lessons to individual students  Teachers and students use custom mobile chat apps for real-time Q&A during lectures  Homework assignments can be completed offline anywhere
  • 27. Offline Sensor Data A weather balloon could collect sensor data while offline and sync it whenever it is online
  • 28. Travel Expense Tracker • I am in Tokyo, but my iPhone 5 is locked so I cannot use a local SIM card. • But I need an app to track my expenses, so I must be able to enter expenses while offline. • When I get back to the US, I want to sync these expenses to the Cloud so I can download a spreadsheet.
  • 29. Resources • These slides will be made available on SlideShare • Sample code links • https://github.com/couchbaselabs/ToDoLite-Android • https://github.com/couchbaselabs/ToDoLite-iOS • https://github.com/tleyden/office-radar • Documentation • http://developer.couchbase.com/mobile • Download - http://mobile.couchbase.com • Contact: [email protected]
  • 30. Resources 2 • Couchbase Mobile Google Group (community): groups.google.com/group/mobile-couchbase/ • Couchbase Mobile Twitter: https://twitter.com/CouchbaseMobile • Run Sync Gateway (and Couchbase Server!) under Docker: http://tleyden.github.io/blog/2014/06/22/running-couchbase- sync-gateway-on-gce/
  • 31. Upcoming Event: Hackathon • http://couchbasejpcommunity.doorkeeper.jp/events/13988
  • 32. Upcoming Event: Couchbase Server • Couchbase Server http://couchbasejpcommunity.doorkeeper.jp/events/14785