should the controller talk to the presenter?
Asked Answered
F

0

5

In the Clean Architecture by Robert Martin, let's say I have this simplified version (not showing other stuff like Model, Gateway, Boundaries):

enter image description here

Now let's say I have a View with 2 buttons, Dark and Light, that when clicked should change the background color of the View and show some text on the screen (the text's color should always be blue). So I though of something like this:

enter image description here

Assuming here that I have to use one method in the controller for both buttons (maybe because it was a form or whatever), the button variable in buttonClicked(button) will contain the information on whether the Dark or Light button was pressed.

Now, the Interactor in this case is only responsible for retrieving the text to be displayed, but it doesn't need to know anything about the background color.

So, should the controller tell the presenter which color (i.e. button) was chosen or should I relay this information to the Interactor just so that it can pass it to the Presenter? Keeping in mind that the Interactor won't even use this information.

Flagitious answered 6/4, 2015 at 6:16 Comment(2)
@ctietze what do you think about this?Flagitious
I think the dependency circle you are drawing here violates the clean architectures main idea. Your interactor should not know anything about the controller or the presenter or the view. This is what these typical circle drawings mean, when talking about clean architecture. See Uncle Bob's original blog postBillion

© 2022 - 2024 — McMap. All rights reserved.