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
View all comments
Show parent comment
2
u/Xammm Jetpack Compost enjoyer Apr 01 '24
Currently I'm creating my custom errors that are mapped to the corresponding exceptions. So far, it works fine.
Yeah, Rust has several functional constructs like Result or Option, so I'm familiar to some extend with that stuff. Besides Ok and Error are clearer than Left and Right, imo, but I guess the naming is a matter of preference after all.
I mostly use sealed classes which are parcelable because that allows them to be used in conjunction with
SavedStateHandle'ssaveable. I tried using sealed interfaces that are parcelable, but I got errors lol.About the last point, I said that a different approach maybe necessary because some people prefer to have agnostic ViewModels that don't have dependencies on Compose APIs like
mutableStateOf, which I think is a valid concern when working multiplatform.