Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Droidy Architectures in a messy world

Droidy Architectures in a messy world

Slides of the talk I gave at DevFest1 Veneto 2017

6923bdeb363961b064d2cdb6329982d6?s=128

Roberto Orgiu

December 02, 2017
Tweet

More Decks by Roberto Orgiu

Other Decks in Programming

Transcript

  1. Droidy in a messy Architectures world

  2. @_tiwiz

  3. Introducing Architecture Components…

  4. None
  5. Expected reaction

  6. YOU ARE NOT FORCED TO USE THEM ALL AT THE

    SAME TIME. Someone, somewhere
  7. None
  8. Other expected reaction

  9. LIVEDATA

  10. veryLongCalculation()

  11. veryLongCalculation() expecting result?

  12. veryLongCalculation()

  13. veryLongCalculation() synchronous

  14. veryLongCalculation() synchronous

  15. veryLongCalculation()

  16. veryLongCalculation() listener

  17. veryLongCalculation()

  18. veryLongCalculation() .observe()

  19. veryLongCalculation() .observe()

  20. ROOM

  21. list_of_cities.json

  22. list_of_cities.json List<City>

  23. list_of_cities.json List<City> $

  24. list_of_cities.json List<City> Cache

  25. List<City> Cache

  26. List<City> Cache $

  27. VIEWMODEL

  28. getDataFromBackend()

  29. getDataFromBackend() dataPresenter

  30. getDataFromBackend() dataPresenter ?

  31. getDataFromBackend() dataPresenter viewModel

  32. getDataFromBackend() dataPresenter viewModel !

  33. LIFECYCLE

  34. clientApi.onCreate() clientApi.onStart() clientApi.onStop() clientApi.onDestroy()

  35. clientApi.onCreate() clientApi.onStart() clientApi.onStop() clientApi.onDestroy() Activity

  36. clientApi.onCreate() clientApi.onStart() clientApi.onStop() clientApi.onDestroy() Activity

  37. clientApi.onCreate() clientApi.onStart() clientApi.onStop() clientApi.onDestroy() LifecycleObserver Activity

  38. clientApi.onCreate() clientApi.onStart() clientApi.onStop() clientApi.onDestroy() LifecycleObserver Activity

  39. clientApi.onCreate() clientApi.onStart() clientApi.onStop() clientApi.onDestroy() LifecycleObserver Activity

  40. None
  41. ProcessLifecycleOwner

  42. None
  43. None
  44. WebView

  45. WebView

  46. ON_START

  47. ON_START Save system status Apply app status (system wide)

  48. ON_STOP

  49. ON_STOP Load system status Apply back system status

  50. PAGINATION

  51. List<City>

  52. List<City> RecyclerView

  53. List<City> RecyclerView $

  54. List<City>

  55. List<City> PagedListAdapter

  56. List<City> PagedListAdapter no lag!

  57. List<City> PagedListAdapter no lag! better UX!

  58. None
  59. None
  60. open.nytimes.com @nytdev github.com/NYTimes developers.nytimes.com

  61. Thank You

  62. Q?