Upload
ihor-malytskyi
View
3.258
Download
0
Tags:
Embed Size (px)
Citation preview
CouchDB/PouchDB approach for hybrid mobile applicationsIhor Vlasyuk, SoftServe
Who I am?
Technical Lead at SoftServe.Involved to mobile development.
Agenda
● Modern solution architecture overview● Typical Problems● Quick solutions overview● PouchDB/CouchDB concept● QA
Typical Modern Solution
Let’s Digg
What we have?
● Server side API code● Frontend code● Native mobile code● Database code
What With Mobile Code?
What With Developers?
What Are Results?
● Lot of platform specific code● Problem with synchronization● Lot of peoples involved to project● Lot of different technologies used
And What to Do?
And What to Do?
Don’t ask me I don’t know. No Pain No Gain.
Let’s think together
● We need to minimize number of technologies used on project
● Nice to have one code base
Cross Platform Solutions
Let’s Holy War begin
Quick Overview
Quick Overview
● Native applications● Web based applications● Hybrid applications
Native Applications
Pros● Offers best user experience to build
complex, reach and responsive applications that offer the best performance
● Has access to all native features provided by platform
Native Applications
Cons● Its typically device and platform
specific● Requires installation, upgrading and
uninstallation● Distribution of the application is more
cumbersome and it’s often depended from AppleStore, Android market etc.
Web Based Applications
Pros● Reuses existing web applications● Minor tweaks to CSS and HTML are
enough to change UI experience● No installation, upgrade, uninstall● HTML5 can take advantage some
native features like geolocation, local storage etc.
Web Based Applications
Cons● Even with HTML5, access to native
features is very limited● Difficult to implement application that
will work in disconnected state● Performance and usability is not as
good as native applications
Hybrid Applications
Hybrid applications are built by combining native components and web components. Web components are built using HTML, CSS, and JavaScript and wrapped by a native container (internal browser) that not only displays them but also gives them access to native functionality through JavaScript.
Hybrid Applications
Pros● Existing web assets can be used.● Access to all native features.● Can provide a rich user experience by
using native components intelligently
Hybrid Applications
Cons● Accessing native functionality using
JavaScript comes with a certain overhead and is not as efficient as a native app.
● UI with HTML5 and CSS still not so responsive as native
No Silver Bullet
So we went with Cordova
Stop! And What With This?
● Lot of platform specific code● Problem with synchronization● Lot of peoples involved to project● Lot of different technologies used
Aha Unresolved Problem
● Lot of platform specific code● Problem with synchronization● Lot of peoples involved to project● Lot of different technologies used
Welcome CouchDB
What is CouchDB?
CouchDB is one of what many are calling NoSQL solutions. Specifically, CouchDB is a document-oriented database and within each document fields are stored as key-value maps. Fields can be either a simple key/value pair, list, or map.
What is CouchDB?
CouchDB offers us these features:● Easy replication of a database across
multiple server instances● REST-like interface for document
insertion, updates, retrieval and deletion
● JSON-based document format (easily translatable across different languages)
Sync Problem
Sync Problem
Sync Problem
Welcome PouchDB
WTF?
You Said that we are trying to decrease number of technologies used in solution?
What is PouchDB?
PouchDB is a JavaScript implementation of CouchDB. Its goal is to emulate the CouchDB API with near-perfect fidelity, while running in the browser or in Node.js.
What is PouchDB?
PouchDB and CouchDB were designed for one main purpose: sync. Jason Smith has a great quote about this:The way I like to think about CouchDB is this: CouchDB is bad at everything, except syncing. And it turns out that's the most important feature you could ever ask for, for many types of software."
PouchDB concept
With PouchDB
CouchDB, PouchDB and Cordova
Setup
<script src="pouchdb-3.5.0.min.js"></script>
Synchronization
Conflicts
Messaging (pub/sub)
Questions?