I have a modular Android application following Clean Architecture, where each module is responsible for a specific feature.
I have a Recipe Module that...
... fetches recipe data from the server based on ID search or general search.
... passes data through the Repository → Use Case → Presentation Layer.
Now, I have a Profile Module, which contains a section called Favorite Recipes. This section also needs to fetch recipes by ID, similar to how the Recipe Module does.
My Problem
Since the Recipe Module already has the logic for fetching recipes, should I rewrite the same logic in the Profile Module, or is there a way to reuse the existing logic without making the Profile Module tightly coupled with the Recipe Module?
Current Structure:
recipe-domain (Use Cases, Repository Interface, Models)
recipe-data (Repository Implementation, Network Calls, DB)
recipe-ui (Screens, ViewModels)
profile-module (has Favorite Recipes section)
I want the Profile Module to reuse the recipe fetching logic without depending on the entire Recipe Module (which includes UI components).
Now::
Should the Profile Module depend directly on the Recipe Module, or should I extract a shared domain module?
How do I manage dependencies efficiently to maintain modularity and separation of concerns?
What is the best way to share Use Cases between different modules?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744837396a4596347.html
评论列表(0条)