Handling related Room entities with Clean Architecture in a multi-module project on Android

24 Views Asked by At

On my Android App, I have 2 entity / models closely related and I'm having trouble finding the best way to handle it.

For the modules, I divide my app by feature then by layer like that :

Feature1
 └ Data
 └ Domain
 └ Presentation
Feature2
 └ Data
 └ Domain
 └ Presentation

If I put them in separate 'features' they end up needing each other's modules and we can't make 2 modules depend on each other.

Should I :

  • Merge those entities in the same feature with a shared repository (knowing they have operations, UI elements, util classes, etc. that don't depend on the other entity)
  • Make another 'feature' with a DAO that uses both tables for the joined operations
  • Separate the features in more modules (ex: a module for entities to have access to each other's tables in each data layer)
  • Another solution ?
0

There are 0 best solutions below