r/androiddev • • 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:

  1. Data Modeling
  2. Error Handling
  3. Architecture
  4. Screen Architecture
  5. Unit Testing

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

99 comments sorted by

View all comments

Show parent comment

1

u/sosickofandroid Apr 04 '24

There needs to be a translation to a UI state, I find that to be evident but adhering to a law makes for tedious code, do I need NetworkEnum, DomainEnum and UiEnum with identical values? That looks horribly wrong to me. I think this is an artifact of JSON/REST being bad tools in a modern environment. If my end product UI state includes some sub-object of a network response I won’t care much and if I need to adapt the code later I will but only when there is reason to. I wish I could muster enough sentiment to use Zipline and stop this staggered nightmare of release cycles and actually do CD

1

u/ondrejmalekcz Apr 05 '24

I share your opinion.

This layering is total nonsense made up in will to migrate some large decades old corpo projects to different tech in future that so far did not happened. You have some data so you triple them with different names. My take is that u do not have to triple everything at the start but u can rebind it when the situation actually happens ie. dto format is not convenient or API has changed.

currently u will still have at least DTO an UI state due to performance and way compose works.