Search code examples
androiduse-caseclean-architecturedynamic-feature-module

How to access same usecase inside multiple feature modules


in the case of real large project, i have decided to use clean architecure inside each feature module of my application separately, preventing to have one Giant domain and data layer against too many features. Now , I'm thinking how to do bestEffort for my issue : if some usecases (like accessing UserInfo) may needed by several feature modules , how to prevent duplicating of creating same domain and data class ?

P.S : I myself decided to have shared-modules for domain and data , which present usecases needed by multipke features. but in this way, there is no boundary or some rules that team mates could understand the specefic usecase is available inside shared-moudle.

modules in project :

  • app

  • common

  • features

    -login

        -domain
    
    
        -data
    
    
        -ui
    

    -charge

        -domain
    
    
        -data
    
        -ui
    

...


Solution

  • For erveryone reading this ,I decided to package my these common usecases( like everything related to user infomation , such as userinfo ) into another common module named UserModule Which has its own data and domain module without any presentation module. Other modules that may need userInfo can implement this module , so they can have their own clean arch with domain , data , presentation based on their need , or have only the presentation layer