Denis Brandi
Sep 30, 2021

--

Hi Bawenang, thanks for reading the article!

The repository is the interface adapter of the persistence, where the repository interface is the secondary port of the domain and the repository implementation is the adapter that converts DataStores data (DTOs) into Entities and viceversa.

The domain models like Product, User... are the entities.

The datastores (api service, preferences) are the framework.

The mappers are just a delegate for simplifying the repository logic, basically they are a helper class for the Interface adapter.

I wrote an article explaining the use case here -> https://proandroiddev.com/why-you-need-use-cases-interactors-142e8a6fe576#:~:text=With%20Use%20Cases,-Let's%20now%20add&text=All%20the%20previous%20dependencies%20stay,Cases%20instead%20of%20the%20ViewModels.&text=And%20at%20last%20reusability%3A%20thanks,reuse%20the%20same%20Use%20Cases.

--

--