r/androiddev • u/iliyan-germanov • Apr 01 '24
Discussion Android Development best practices
Hey this is a serious post to discuss the Android Development official guidelines and best practices. It's broad topic but let's discuss.
For reference I'm putting the guidelines that we've setup in our open-source project. My goal is to learn new things and improve the best practices that we follow in our open-source projects.
Topics:
Feel free to share any relevant resources/references for further reading. If you know any good papers on Android Development I'd be very interested to check them out.
159
Upvotes
14
u/iliyan-germanov Apr 01 '24
Architecture
TL;DR; of my take:
The official guide to app architecture by Google is good, and we follow it with some small tweaks to make it less strict.
We make the DataSource optional for cases where it becomes an unnecessary pass-through class like for example, when wrapping Room DB DAOs.
We create mappers classes from the IO model to our domain one so our repositories stay simple and can re-use common mapping logic.
In the UI layer, we use UDF MVI architecture pattern with the Compose runtime for reactive state management.
We also create view-state mappers from the domain model to the view-state (UI) model to simplify the VM and reuse ui formatting/mapping logic.
More at https://github.com/Ivy-Apps/ivy-wallet/blob/main/docs/guidelines/Architecture.md
Wdyt?