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

Mvvm__Compose__UTP_-_A_killer_combination_for_successful_deliveries.pdf

 Mvvm__Compose__UTP_-_A_killer_combination_for_successful_deliveries.pdf

'Nitrogenize' your project with Mvvm, Compose, UTP - A killer combination for successful deliveries
Compose took on the table a new approach to developing in Android. Besides this great new framework, large portions of our apps won’t change at all, and Unidirectional Data Flow best practices should be used.

What will change in our project? Which patterns should we adapt in our app to work with these new techs? Is my app ready to be migrated with Compose? Let's see how use this new declarative UI framework in an already structured and organised project maintaining its own design pattern architecture.
What will be the advantages and disadvantages?

Unified Test Platform (UTP), best known as project code Nitrogen, it's another fantastic tech presented this year at Google IO. Let's see together what it is, why is so useful and why we should adopt it in our app.
We will use this extensible test executor to 'nitrogenize' our UI test suite covering some UI cases in our project. Let's scale together our test suite with Gradle managed devices in parallel using new test metrics, and finally, inspecting test results and possible failures by emulator snapshots.

After this talk, you will know if your app architecture is ready for Compose, you will be ready to transform your test suite into a more reliable scalable and productive env and you will speed up the delivery and the code quality of your project.

Enrico Bruno Del Zotto

November 25, 2022
Tweet

More Decks by Enrico Bruno Del Zotto

Other Decks in Technology

Transcript

  1. Nitrogenize Jetpack Compose + MV(x) + UTP = A killer

    combination for succesul deliveries @enricobdelzotto
  2. @enricobdelzotto About me •Enrico •Italian •Android engineer •London based

  3. Agenda Compose Architectural patterns Testing

  4. @enricobdelzotto Android Ui Kit has been build since Sept 2008

    Old times
  5. @enricobdelzotto Imperative Explicit instruction The system is stupid -> You

    are smart
  6. @enricobdelzotto

  7. @enricobdelzotto Google IO 2019 : Jetpack Compose

  8. @enricobdelzotto Declarative Describe the Outcome The system is smart, you

    don’t care
  9. @enricobdelzotto Declarative

  10. @enricobdelzotto Unidirectional data flow (UDF) Composition vs Inheritance Encapsulation Statless

    vs stateful Composition / Re-composition
  11. @enricobdelzotto Unidirectional data flow (UDF)

  12. @enricobdelzotto Composition vs Inheritance

  13. @enricobdelzotto

  14. @enricobdelzotto Encapsulation https://developer.android.com/jetpack/compose/state

  15. @enricobdelzotto Statless vs stateful

  16. @enricobdelzotto Statless vs stateful LaunchedEffect RememberCoroutineScope RememberUpdatedState DerivedStateOf snapshotFlow …

    https://developer.android.com/jetpack/compose/side-e ff ects
  17. @enricobdelzotto Observe a state and re-compose by collectAsState() https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#structuralEqualityPolicy()

  18. @enricobdelzotto

  19. @enricobdelzotto Re-composition

  20. @enricobdelzotto Compose handles re-creation intelligently It’s using a slot table

    built using gap buffers
  21. @enricobdelzotto https://medium.com/androiddevelopers/under-the-hood-of-jetpack-compose-part-2-of-2-37b2c20c6cdd

  22. @enricobdelzotto https://medium.com/androiddevelopers/under-the-hood-of-jetpack-compose-part-2-of-2-37b2c20c6cdd State holders ViewModels as source of truth

  23. @enricobdelzotto UDF strengths

  24. @enricobdelzotto MVP

  25. @enricobdelzotto https://dev.to/alyssoncs/jetpack-compose-don-t-throw-your-presenters-o ff -43fk

  26. @enricobdelzotto (Jetpack) MVVM

  27. @enricobdelzotto MVI

  28. @enricobdelzotto Clean architecture Control over ui and async events A

    predefined test structure Quick debugging environment
  29. @enricobdelzotto A predefined test structure

  30. @enricobdelzotto Jetpack compose testing api

  31. @enricobdelzotto Jetpack compose rules Compose test rule Android compose test

    rule
  32. @enricobdelzotto Jetpack compose rules

  33. @enricobdelzotto

  34. @enricobdelzotto

  35. @enricobdelzotto Interoperability with Espresso

  36. @enricobdelzotto Clean architecture Control over ui and async events A

    predefined test structure Quick run and debugging environment
  37. @enricobdelzotto https://developer.android.com/studio/preview/features

  38. @enricobdelzotto https://developer.android.com/studio/preview/features

  39. @enricobdelzotto Optimize performances -> Use espresso intents to validate your

    outgoing intents Automated test devices
  40. @enricobdelzotto

  41. @enricobdelzotto

  42. @enricobdelzotto

  43. @enricobdelzotto Take and save screenshot of the system if our

    tests failed. Warning : on depending on hw rendering, aren’t supported when using ATDs. Emulator snapshot
  44. @enricobdelzotto

  45. @enricobdelzotto

  46. None
  47. None
  48. Recap ?

  49. @enricobdelzotto Clean architecture Control over ui and async events A

    predefined test structure Quick run and debugging environment TL;DR
  50. @enricobdelzotto

  51. @enricobdelzotto

  52. Thanks @enricobdelzotto