Abhishek Sharma
01/24/2025, 1:35 AM:feature:home
and :feature:reviews
) that need a use case combining data from two domain modules (:domain:books
and :domain:reviews
). For example, Feature A
and Feature B
both require data that comes from a composition of BooksUseCase
(from :domain:books
) and ReviewsUseCase
(from :domain:reviews
).
A few approaches come to mind:
1. Create a new module (e.g., :domain:books-reviews
) to house the combined use case logic. However, this introduces horizontal dependency, as the new domain module depends on both :domain:books
and :domain:reviews
, potentially violating clean architecture principles of vertical dependency.
2. Place the combined logic in a common domain module (:domain:common
). But in a large app, this could lead to bloating and tightly coupling unrelated shared logic in a single module.
3. Move the composition logic to the feature layers and directly invoke the relevant use cases from the domain modules. However, this risks duplicating logic across multiple features if the combination logic is reused.
What is the best way to handle this scenario while maintaining modularity, scalability, and adherence to clean architecture principles? Is it acceptable to have a cross-domain dependency in such cases, or should the logic live elsewhere (e.g., feature layer or backend)? Any recommendations or best practices for managing such cross-domain use cases in large apps?aishwaryabhishek3
01/24/2025, 1:58 PMaishwaryabhishek3
01/24/2025, 1:59 PMJoel Denke
01/25/2025, 3:05 PMAbhishek Sharma
01/28/2025, 3:28 PMaishwaryabhishek3
01/28/2025, 3:38 PMJoel Denke
01/28/2025, 3:39 PMAbhishek Sharma
02/05/2025, 5:43 PMJoel Denke
02/05/2025, 6:35 PMAbhishek Sharma
02/06/2025, 1:06 AMAhmet Özcan
03/10/2025, 5:48 PM