android10 / Android-CleanArchitecture

This is a sample app that is part of a series of blog posts I have written about how to architect an android application using Uncle Bob's clean architecture approach.
Apache License 2.0
15.52k stars 3.32k forks source link

Multiple repository #275

Open BishoyAbd opened 6 years ago

BishoyAbd commented 6 years ago

I have some confusion regarding the repository pattern.my question is can I use more than one repository, for example, UserRepository, QuestionRepository, AnotherThingRepository.trying to follow the Single responsibility principle, and then create a Wrapper repository to hold all the repos.

alexwhb commented 6 years ago

@BishoyAbd You can create as many repositories as needed for your project... with that said you should create repositories that are specific and not accessing data outside of their domain to stick to the SRP. Like the User repository should not return data that the QuestionRepository should be returning. If that makes sense.

mishkaowner commented 5 years ago

@alexwhb obviously that makes no sense. First of all, the repository pattern used in this project is quite different than what the uncle bob introduced in his work. He used it as Domain model gateway. You are just confused with this project (apparently, old 3 tier architecture remix+) and the bob's clean architecture. For the original question, you may have one repo for one entity if you follow bob's clean Arch...