12

I have 2 use cases LoadA and LoadSettings, in LoadA I need to access the Settings returned from LoadSettings. The business is designed so that if Settings is not yet exist then a default Setting would be returned.

The default initialization logic is put inside LoadSettings, but now the LoadA must depend on the LoadSettings instead of calling the SettingsRepository, thus creating a peer-dependency.

Is this anti-pattern in term of strictly following Clean Architecture?

Chinh Nguyen
  • 583
  • 1
  • 7
  • 14
  • Possible duplicate https://stackoverflow.com/questions/40458666/the-clean-architecture-usecase-dependencies – Ahmed Ashraf Apr 06 '19 at 21:54
  • Thanks for link! It's a duplicate even there is no accepted answer in the other question. And I don't think the only answer there is correct in my case! – Chinh Nguyen Apr 07 '19 at 08:44

1 Answers1

4

There have already been multiple answers to the question "May interactors call other interactors?" here on stackoverflow.

My favorite one is this Clean Architecture: Combining Interactors (Answer by Ben Neill) and I also follow it in my own projects.

plainionist
  • 2,950
  • 1
  • 15
  • 27