Couch DB/PouchDB approach for hybrid mobile applications

4,471 views

Published on

by Ihor Vasylyk

Published in: Mobile
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,471
On SlideShare
0
From Embeds
0
Number of Embeds
3,011
Actions
Shares
0
Downloads
16
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Couch DB/PouchDB approach for hybrid mobile applications

  1. 1. CouchDB/PouchDB approach for hybrid mobile applications Ihor Vlasyuk, SoftServe
  2. 2. Who I am? Technical Lead at SoftServe. Involved to mobile development.
  3. 3. Agenda ● Modern solution architecture overview ● Typical Problems ● Quick solutions overview ● PouchDB/CouchDB concept ● QA
  4. 4. Typical Modern Solution
  5. 5. Let’s Digg
  6. 6. What we have? ● Server side API code ● Frontend code ● Native mobile code ● Database code
  7. 7. What With Mobile Code?
  8. 8. What With Developers?
  9. 9. What Are Results? ● Lot of platform specific code ● Problem with synchronization ● Lot of peoples involved to project ● Lot of different technologies used
  10. 10. And What to Do?
  11. 11. And What to Do? Don’t ask me I don’t know. No Pain No Gain.
  12. 12. Let’s think together ● We need to minimize number of technologies used on project ● Nice to have one code base
  13. 13. Cross Platform Solutions
  14. 14. Let’s Holy War begin
  15. 15. Quick Overview
  16. 16. Quick Overview ● Native applications ● Web based applications ● Hybrid applications
  17. 17. 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
  18. 18. 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.
  19. 19. 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.
  20. 20. 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
  21. 21. 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.
  22. 22. 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
  23. 23. 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
  24. 24. No Silver Bullet
  25. 25. So we went with Cordova
  26. 26. Stop! And What With This? ● Lot of platform specific code ● Problem with synchronization ● Lot of peoples involved to project ● Lot of different technologies used
  27. 27. Aha Unresolved Problem ● Lot of platform specific code ● Problem with synchronization ● Lot of peoples involved to project ● Lot of different technologies used
  28. 28. Welcome CouchDB
  29. 29. 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.
  30. 30. 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)
  31. 31. Sync Problem
  32. 32. Sync Problem
  33. 33. Sync Problem
  34. 34. Welcome PouchDB
  35. 35. WTF? You Said that we are trying to decrease number of technologies used in solution?
  36. 36. 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.
  37. 37. 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."
  38. 38. PouchDB concept
  39. 39. With PouchDB
  40. 40. CouchDB, PouchDB and Cordova
  41. 41. Setup <script src="pouchdb-3.5.0.min.js"></script>
  42. 42. Synchronization
  43. 43. Conflicts
  44. 44. Messaging (pub/sub)
  45. 45. Questions?

×