SlideShare a Scribd company logo
1 of 20
Download to read offline
POTATO
         POTATO page 1
Why Potato?
SQL is so 80’s.



                  Wake me up before you:

                  •		 Map objects to tables

                  •	 	 Write serializers

                  •		 Write queries

                  •		 Implement content provider schemes



                                               POTATO page 2
Potato v. Android


               Application needs:

               •	 Fetch data from web service

               •	 Persistence

               •	 UI that relies on objects




                                      POTATO page 3
Android API

              •	 SQLite
                  - SQLiteOpenHelper
                  - DB Schema
                  - Cursor
                  - ContentValues
              •		ContentProvider

              •		Loader

              •		ListView

              •		Observer

                                   POTATO page 4
Potato


         •		Storage
           	 - Storage.List
              - Subscriptions

         •		Poll

         •		PollListView




                           POTATO page 5
Storage
•	 Non-volatile storage via json serialization

•	 Based on generic lrucache<string,t> (least recently used)
     - size device dependent

•	 Push(t object)

•	 Delete(string id)



public class UserStorage extends Storage<User> {
....
     @Override
     public String id(User user) {
          return user.getId();
     }
...
}                                                              POTATO page 6
Storage.List
•	 A section of storage

•	 Obtain list from storage

•	 Implements java.Util.List<t>


Storage<User>.List friends = UserStorage.obtainList(Const.LIST_FRIENDS);

Storage<User>.List followers = UserStorage.obtainList(Const.LIST_FOLLOWERS);




                                                                           POTATO page 7
Storage.Subscription List
•	Subscribe for a single object or list

•	React to different actions (PUSH, DELETE … )


UserStorage.getInstance().obtainList(Const.LIST_FOLLOWERS).subscribe(new Storage.
Subscription() {
@Override
          public void onUpdate(Action action) {
          mFollowerLabel.post(new Runnable() {
              @Override
            	 public void run() {
                   ...
                 }
             });
        }
});




                                                                         POTATO page 8
Storage.Subscription Object
UserStorage.getInstance().subscribe(mUserId, new Subscription() {
       @Override
         public void onUpdate(Action action) {
            mUserLabel.post(new Runnable() {
                @Override
            	 public void run() {
                   ...
                }
            });
       }
});




                                                                    POTATO page 9
Poll
What can it do for you?




•	 Associated to a storage.List

•	 Fetch new data

•	 Fetch old data

•	 States OK / NO_CONTENT / ERROR




                                    POTATO page 10
Poll
What you have to do...



•	 setStorage(Storage<T>.List storage)

•	 ArrayList<User> newItems()

•	 ArrayList<User> oldItems()

•	 int appendNewItems(ArrayList<T> newItems, Listener listener,
  boolean cleanUp)

•	 int appendOldItems(ArrayList<T> newItems, Listener listener)


                                                           POTATO page 11
PollListView
•	 Extends com.handmark.pulltorefresh.PullToRefreshListView

•	 Bound a poll with a ListView
  		 - new data on pull to refresh
  		 - old data on scroll

•	 Subscribes for poll’s Storage.List

•	 Attached to Activity/Fragment lifecycle
     	 - save/load/update

•	 Different adapters related to poll state



                                                          POTATO page 12
Potato structure
                           Storage
                                                           Most used

                           object              object   object     object
     Storage.List


    object        object   object              object   object     object
                                                                                              Storage.List


      Less used
                           object              object   object     object      object               object




                                                                               Storage.List
                           object              object   object     object




                                               object
                                Storage.List




                                               object
                                                                         Subscribe to events coming
                                                                        from lists or individual items

                                                                                                             POTATO page 13
Performance diagram




                      POTATO page 14
Interaction diagram
 API                 Poll            Storage.List                 PollListView               AnimatedPollAdapter

                                                   1. update               (UI)                                       (UI)
       2. API call


       return data
                            3. add Upfront




                                                              {
                                                                        4. notify DataWillUpdate
                                             Event is published
                                              over subscription
                                                         model
                                                                        5. notify DataSetChangedWithAction




                                                                                                             notify DataSetChanged




                                                                                                                  POTATO page 15
Extra potato
Potato can do even more




                          POTATO page 16
Example




          POTATO page 17
Pota TO DO:

•	 Object revisioning ( createdAt / updatedAt )

•	 More work on UI

•	 Java code generation with universal Boll (to any API)




                                                           POTATO page 18
End
Fork the potato

https://github.com/eyeem/PotatoLibrary


                              Tobias Heine
                              tobi@eyeem.com
                              @tobias_heine

                              Łukasz Wisniewski
                              lukasz@eyeem.com
                              @vishna




                                               POTATO page 19
Join us in building the
future of photo discovery

We’re always looking for passionate iOs, Android, Backend, Frontend
and DevOps engineers.



Jobs@EyeEm.com




                                                         POTATO page 20

More Related Content

Viewers also liked

5-5-2014 - api days - documentationless api
5-5-2014 - api days - documentationless api5-5-2014 - api days - documentationless api
5-5-2014 - api days - documentationless apiEyeEm
 
Cusersvctordocumentsgomplayerliteraturaromntica 090324053046-phpapp01
Cusersvctordocumentsgomplayerliteraturaromntica 090324053046-phpapp01Cusersvctordocumentsgomplayerliteraturaromntica 090324053046-phpapp01
Cusersvctordocumentsgomplayerliteraturaromntica 090324053046-phpapp01dracucarol
 
101 belly fat-weight-loss
101 belly fat-weight-loss101 belly fat-weight-loss
101 belly fat-weight-lossDani El
 
Bangladesh humanitarian geopolitical briefing
Bangladesh humanitarian geopolitical briefingBangladesh humanitarian geopolitical briefing
Bangladesh humanitarian geopolitical briefingmmagario
 
Cómo exportar a Vietnam
Cómo exportar a VietnamCómo exportar a Vietnam
Cómo exportar a VietnamTIBA
 
Risk assessment presentation
Risk assessment presentationRisk assessment presentation
Risk assessment presentationmmagario
 
4 Amazing Sales Tools I Use Every Day - Be Effective - Tools to Close Deals F...
4 Amazing Sales Tools I Use Every Day - Be Effective - Tools to Close Deals F...4 Amazing Sales Tools I Use Every Day - Be Effective - Tools to Close Deals F...
4 Amazing Sales Tools I Use Every Day - Be Effective - Tools to Close Deals F...Daniel Nilsson
 

Viewers also liked (10)

Ireland's story pics
Ireland's story picsIreland's story pics
Ireland's story pics
 
Dethivadapanly 12doc
Dethivadapanly 12docDethivadapanly 12doc
Dethivadapanly 12doc
 
5-5-2014 - api days - documentationless api
5-5-2014 - api days - documentationless api5-5-2014 - api days - documentationless api
5-5-2014 - api days - documentationless api
 
Cusersvctordocumentsgomplayerliteraturaromntica 090324053046-phpapp01
Cusersvctordocumentsgomplayerliteraturaromntica 090324053046-phpapp01Cusersvctordocumentsgomplayerliteraturaromntica 090324053046-phpapp01
Cusersvctordocumentsgomplayerliteraturaromntica 090324053046-phpapp01
 
101 belly fat-weight-loss
101 belly fat-weight-loss101 belly fat-weight-loss
101 belly fat-weight-loss
 
Bangladesh humanitarian geopolitical briefing
Bangladesh humanitarian geopolitical briefingBangladesh humanitarian geopolitical briefing
Bangladesh humanitarian geopolitical briefing
 
Cómo exportar a Vietnam
Cómo exportar a VietnamCómo exportar a Vietnam
Cómo exportar a Vietnam
 
Risk assessment presentation
Risk assessment presentationRisk assessment presentation
Risk assessment presentation
 
Mi familia
Mi familiaMi familia
Mi familia
 
4 Amazing Sales Tools I Use Every Day - Be Effective - Tools to Close Deals F...
4 Amazing Sales Tools I Use Every Day - Be Effective - Tools to Close Deals F...4 Amazing Sales Tools I Use Every Day - Be Effective - Tools to Close Deals F...
4 Amazing Sales Tools I Use Every Day - Be Effective - Tools to Close Deals F...
 

Similar to Eye em potato_library_presentation

Java Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreJava Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreIMC Institute
 
Tracking user activity logs using Loggastic #ApiPlatformCon
Tracking user activity logs using Loggastic #ApiPlatformConTracking user activity logs using Loggastic #ApiPlatformCon
Tracking user activity logs using Loggastic #ApiPlatformConPaula Čučuk
 
SharePoint TechCon 2009 - 801
SharePoint TechCon 2009 - 801SharePoint TechCon 2009 - 801
SharePoint TechCon 2009 - 801Andreas Grabner
 
LiveFolders as feeds
LiveFolders as feedsLiveFolders as feeds
LiveFolders as feedsGabor Paller
 
Using ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsUsing ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsAtlassian
 
Databases in Android Application
Databases in Android ApplicationDatabases in Android Application
Databases in Android ApplicationMark Lester Navarro
 
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3Paris Android User Group
 
Feed the Masses
Feed the MassesFeed the Masses
Feed the Massespbugni
 
Klout changing landscape of social media
Klout changing landscape of social mediaKlout changing landscape of social media
Klout changing landscape of social mediaDataWorks Summit
 
Python webinar 4th june
Python webinar 4th junePython webinar 4th june
Python webinar 4th juneEdureka!
 
RIPEstat Public demo 21 February 2012
RIPEstat Public demo 21 February 2012RIPEstat Public demo 21 February 2012
RIPEstat Public demo 21 February 2012RIPE NCC
 
Project onion - Project Architecture for .Net Core Application
Project onion - Project Architecture for .Net Core ApplicationProject onion - Project Architecture for .Net Core Application
Project onion - Project Architecture for .Net Core ApplicationAbhinav Jha
 
Deploy your contents with entity share
Deploy your contents with entity share   Deploy your contents with entity share
Deploy your contents with entity share Smile I.T is open
 
Android Architecture Components with Kotlin
Android Architecture Components with KotlinAndroid Architecture Components with Kotlin
Android Architecture Components with KotlinAdit Lal
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdfsunwooindia
 

Similar to Eye em potato_library_presentation (20)

Introduction to Datastore
Introduction to DatastoreIntroduction to Datastore
Introduction to Datastore
 
Java Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreJava Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : Datastore
 
Tracking user activity logs using Loggastic #ApiPlatformCon
Tracking user activity logs using Loggastic #ApiPlatformConTracking user activity logs using Loggastic #ApiPlatformCon
Tracking user activity logs using Loggastic #ApiPlatformCon
 
SharePoint TechCon 2009 - 801
SharePoint TechCon 2009 - 801SharePoint TechCon 2009 - 801
SharePoint TechCon 2009 - 801
 
LiveFolders as feeds
LiveFolders as feedsLiveFolders as feeds
LiveFolders as feeds
 
Livefoldersasfeeds
LivefoldersasfeedsLivefoldersasfeeds
Livefoldersasfeeds
 
Using ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian PluginsUsing ActiveObjects in Atlassian Plugins
Using ActiveObjects in Atlassian Plugins
 
Databases in Android Application
Databases in Android ApplicationDatabases in Android Application
Databases in Android Application
 
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
 
Feed the Masses
Feed the MassesFeed the Masses
Feed the Masses
 
Klout changing landscape of social media
Klout changing landscape of social mediaKlout changing landscape of social media
Klout changing landscape of social media
 
.Net template solution architecture
.Net template solution architecture.Net template solution architecture
.Net template solution architecture
 
Mobile application development: part 1: Andriod Vs IOS
Mobile application development: part 1: Andriod Vs IOS Mobile application development: part 1: Andriod Vs IOS
Mobile application development: part 1: Andriod Vs IOS
 
Python webinar 4th june
Python webinar 4th junePython webinar 4th june
Python webinar 4th june
 
Architecture and RxJava
Architecture and RxJavaArchitecture and RxJava
Architecture and RxJava
 
RIPEstat Public demo 21 February 2012
RIPEstat Public demo 21 February 2012RIPEstat Public demo 21 February 2012
RIPEstat Public demo 21 February 2012
 
Project onion - Project Architecture for .Net Core Application
Project onion - Project Architecture for .Net Core ApplicationProject onion - Project Architecture for .Net Core Application
Project onion - Project Architecture for .Net Core Application
 
Deploy your contents with entity share
Deploy your contents with entity share   Deploy your contents with entity share
Deploy your contents with entity share
 
Android Architecture Components with Kotlin
Android Architecture Components with KotlinAndroid Architecture Components with Kotlin
Android Architecture Components with Kotlin
 
아이폰강의(4) pdf
아이폰강의(4) pdf아이폰강의(4) pdf
아이폰강의(4) pdf
 

Eye em potato_library_presentation

  • 1. POTATO POTATO page 1
  • 2. Why Potato? SQL is so 80’s. Wake me up before you: • Map objects to tables • Write serializers • Write queries • Implement content provider schemes POTATO page 2
  • 3. Potato v. Android Application needs: • Fetch data from web service • Persistence • UI that relies on objects POTATO page 3
  • 4. Android API • SQLite - SQLiteOpenHelper - DB Schema - Cursor - ContentValues • ContentProvider • Loader • ListView • Observer POTATO page 4
  • 5. Potato • Storage - Storage.List - Subscriptions • Poll • PollListView POTATO page 5
  • 6. Storage • Non-volatile storage via json serialization • Based on generic lrucache<string,t> (least recently used) - size device dependent • Push(t object) • Delete(string id) public class UserStorage extends Storage<User> { .... @Override public String id(User user) { return user.getId(); } ... } POTATO page 6
  • 7. Storage.List • A section of storage • Obtain list from storage • Implements java.Util.List<t> Storage<User>.List friends = UserStorage.obtainList(Const.LIST_FRIENDS); Storage<User>.List followers = UserStorage.obtainList(Const.LIST_FOLLOWERS); POTATO page 7
  • 8. Storage.Subscription List • Subscribe for a single object or list • React to different actions (PUSH, DELETE … ) UserStorage.getInstance().obtainList(Const.LIST_FOLLOWERS).subscribe(new Storage. Subscription() { @Override public void onUpdate(Action action) { mFollowerLabel.post(new Runnable() { @Override public void run() { ... } }); } }); POTATO page 8
  • 9. Storage.Subscription Object UserStorage.getInstance().subscribe(mUserId, new Subscription() { @Override public void onUpdate(Action action) { mUserLabel.post(new Runnable() { @Override public void run() { ... } }); } }); POTATO page 9
  • 10. Poll What can it do for you? • Associated to a storage.List • Fetch new data • Fetch old data • States OK / NO_CONTENT / ERROR POTATO page 10
  • 11. Poll What you have to do... • setStorage(Storage<T>.List storage) • ArrayList<User> newItems() • ArrayList<User> oldItems() • int appendNewItems(ArrayList<T> newItems, Listener listener, boolean cleanUp) • int appendOldItems(ArrayList<T> newItems, Listener listener) POTATO page 11
  • 12. PollListView • Extends com.handmark.pulltorefresh.PullToRefreshListView • Bound a poll with a ListView - new data on pull to refresh - old data on scroll • Subscribes for poll’s Storage.List • Attached to Activity/Fragment lifecycle - save/load/update • Different adapters related to poll state POTATO page 12
  • 13. Potato structure Storage Most used object object object object Storage.List object object object object object object Storage.List Less used object object object object object object Storage.List object object object object object Storage.List object Subscribe to events coming from lists or individual items POTATO page 13
  • 14. Performance diagram POTATO page 14
  • 15. Interaction diagram API Poll Storage.List PollListView AnimatedPollAdapter 1. update (UI) (UI) 2. API call return data 3. add Upfront { 4. notify DataWillUpdate Event is published over subscription model 5. notify DataSetChangedWithAction notify DataSetChanged POTATO page 15
  • 16. Extra potato Potato can do even more POTATO page 16
  • 17. Example POTATO page 17
  • 18. Pota TO DO: • Object revisioning ( createdAt / updatedAt ) • More work on UI • Java code generation with universal Boll (to any API) POTATO page 18
  • 19. End Fork the potato https://github.com/eyeem/PotatoLibrary Tobias Heine tobi@eyeem.com @tobias_heine Łukasz Wisniewski lukasz@eyeem.com @vishna POTATO page 19
  • 20. Join us in building the future of photo discovery We’re always looking for passionate iOs, Android, Backend, Frontend and DevOps engineers. Jobs@EyeEm.com POTATO page 20