Android-CleanArchitecture-Kotlin
Android-CleanArchitecture-Kotlin copied to clipboard
beter feature package organisation
The actual feature package (login or movies) contain all class of the feature. I think it doesn't reflect the "clean architecture" responsability split.
I know it's a sample project but like you say in the blog post :
Code/package organization is one of the key factors of a good architecture
I think feature package should at least contain the folowing packages :
- presentation
- domain
- data
The high level package organization should be based on its features (login / movies) However, in my opinion, it would be ok also to use presentation, domain, data directories, inside those feature packages.
what I am doing is, put everything in core package with other utils required in a different module.
Just do not create daggerComponent for it
the module shall be included by all other modules.
now every module can be distinguished with respect to feature.
I think to have 3 tiers package of Clean Architecture is a better practice, just like this:
- movies
- data
- RepositoryImpl
- domain
- UseCase
- presentation
- Views
- ViewModels
- data
And if we have some common usecases or model beans, then we could construct a common package which is at the same level with feature packages to contains them, as followed:
- common
- data
- RepositoryImpl
- domain
- UseCase
- presentation
- Views
- ViewModels
- data
Feature package code can use code in common package, in this way, we can make our code cohesive and reusable as best as we can.