using MVVM or MVP should i name packages like model, viewmodel, view and put proper classes and interfaces there or is it just a logical structure that should not be visible in classes structure?
If you want to go by the book, the current "correct" way to implement MVVM in Android is the Android Architecture Components set of libraries.
Read more about it here, and try this code lab. These will also show you how to name and place your classes.
But in general, you should go with what matches your app best. For smaller apps I would recommend going with M V P folders, while for bigger, more long-term ones tend to work better with folder-per-feature structure.
Google in it's sample Android Architecture project uses Model(Data) V(views) VM(view-models) file structure Google sample sunflower app to show architecture components Probably that's the best approach
Additionnaly you may find this resource interesting https://overflow.buffer.com/2016/09/26/android-rethinking-package-structure/ An implementation is visible here https://github.com/SamYStudiO/beaver
I also would like to indicate watching this TUTORIAL. This guy goes well on teaching about the Architecture MVVM and also uses the ROOM Persistence Library. It is worth giving a look at it.
© 2022 - 2024 — McMap. All rights reserved.