Android-CleanArchitecture-Kotlin
Android-CleanArchitecture-Kotlin copied to clipboard
Code packages
Any reason why you moved away from data/domain/presentation packages for each feature?
...or why the features themselves don't have additional packaging.
waiting for the response......
Strange... Why the project to not have three layers?
Have you ever tried to make an instant app with top-level data/domain/presentation packages?
How an instant app is affected by the different packages?
You have to repackage the whole thing to have top-level modules by features, so having a single presentation
package with adapters/activities
is super bad.
So having a features
package is much better, although personally I prefer to only cut presentation layer to features. I like the Buffer package structure: https://overflow.buffer.com/2016/09/26/android-rethinking-package-structure/
Hey all! There was some big refactor. I wrote a post about it, please check it out: https://fernandocejas.com/2018/05/07/architecting-android-reloaded/
Any feedback is more than welcome!
As mentioned by @Zhuinden , is it possible to cut the presentation layer into features and keep the domain/data part into a separate package? In this way, we can really still easily extract and reuse the common use cases and maybe create some sort of SDK?
In addition, what do you guys think about using the "feature module(s)" to support Android Instant App?
Comments are welcome. :)
@rendecano As an option we can keep only common use cases in separate package or module. Usually the number of common use cases are relatively small.
"SDK" is like an Network Service or other API, it need to be hided from domain and presentation layers and accessed from Repository only or Repository -> Use Case ))
I think the split by feature is wrong here. The split is by contexts (login/movie/settings) then we can split by features (login, logout, see all movies, see movie detail, ...). In this case, you can use 1 module by context.
- contexts
- movie
- list
- Activity/Fragment/UiModels/...
- detail
- endpoint
- Repo/DataModels
- list
- login
- login
- logout
- movie
It's still modules over packages right ? It seems having separate modules like in previous project would be better since it will work really well with new bundle style distribution on Google Play.
Modules are fine and that is the idea when you scale this project. Previously modules were telling you stuff about the architecture of the framework but it did not scale well actually when adding more and more features since every each of those would depend on the 3 layers (modules).
The idea of modularization is to be feature specific where you can plug and unplug features depending on your needs.