0

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?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.