Android-CleanArchitecture-Kotlin icon indicating copy to clipboard operation
Android-CleanArchitecture-Kotlin copied to clipboard

beter feature package organisation

Open ooCHURIoo opened this issue 7 years ago • 3 comments

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

ooCHURIoo avatar Sep 07 '18 08:09 ooCHURIoo

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.

crjacinro avatar Sep 12 '18 18:09 crjacinro

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.

aaghan avatar Apr 09 '20 17:04 aaghan

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

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

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.

Edger avatar May 21 '23 06:05 Edger