You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, just stumbled with your articles on medium and had this quick question regarding the interactor pattern: is an Interactor supposed to have one and only one dependency on a repository or can actually depend on more than one?
For example: Lets suppose that we have a UserProfileInteractor wich has only one method called GetUser and a UserRepository which has N methods (doesn't matter which ones for the sake of the example). Now, that user needs to belong to a Company and that model "belongs" to its own repository called CompanyRepository which has other methods, but specifically one called getCompany that we'll need to invoke to assemble our user on the UserProfileInteractor. For completeness we also have a presenter called UserProfilePresenter which will have an instance of UserProfileInteractor and is in charge of "presenting" the user profile displaying the user information + that user's company data.
How would you handle such a thing? Would you make UserProfileInteractor have dependencies on both UserRepository and CompanyRepository? Would an interactor depending on two repositories violate the separation of concerns in any way?
Cheers and thanks for the articles, really enjoying them.
The text was updated successfully, but these errors were encountered:
Hi, just stumbled with your articles on medium and had this quick question regarding the interactor pattern: is an Interactor supposed to have one and only one dependency on a repository or can actually depend on more than one?
For example: Lets suppose that we have a
UserProfileInteractor
wich has only one method calledGetUser
and aUserRepository
which has N methods (doesn't matter which ones for the sake of the example). Now, that user needs to belong to aCompany
and that model "belongs" to its own repository calledCompanyRepository
which has other methods, but specifically one calledgetCompany
that we'll need to invoke to assemble our user on theUserProfileInteractor
. For completeness we also have a presenter calledUserProfilePresenter
which will have an instance ofUserProfileInteractor
and is in charge of "presenting" the user profile displaying the user information + that user's company data.How would you handle such a thing? Would you make
UserProfileInteractor
have dependencies on bothUserRepository
andCompanyRepository
? Would an interactor depending on two repositories violate the separation of concerns in any way?Cheers and thanks for the articles, really enjoying them.
The text was updated successfully, but these errors were encountered: