Architecture: Which modularisation strategy to choose - devrath/RunTracer GitHub Wiki
Strategy
The more modular the code becomes, The more complex the code becomes.
The more modules you use, The more reusable these blocks are.
Some pointers to choose the strategy
How much do you benefit from being able to re-use the code base?
Do you plan to reuse some of your functionalities in other apps in the future?
Do you plan to migrate your app to the kotlin multi-platform in the future?
How many people will work on the project?
Types of Approaches
Layer-based Modularization
Now the multi-module architecture is only good if you leverage the advantages the multi-module provides
Separation of concerns ( 👍 )
Keeping the layers separate, It is given.
No Faster gradle builds ( 👎 )
Here while there are 3 modules and if a change occurs in one module others necessarily be built but still, we don't gain too much.
See if there is a huge application the layers themselves become big, Here 3 modules building in parallel is not much of a gain. So it will still take a long time to rebuild.
So when your application scales, Having three modules will not help much.
Re-using the specific part of the functionality is very difficult since layer-wise it is bulky.
Not easy to enforce guidelines and separation in a team ( 👎 )
Here developers working on one module can get in the way of another developer working on another module
Feature-based approach
CORE-LAYER
Every layer of the core module is allowed to be accessed with the corresponding layers of the feature modules.
Say the Core-Presentation layer can be allowed to be accessed by Feature-1-Presentation, Feature-2-Presentation, and so on.
Similarly for Core-Domain and Core-Data and so on.