In the Clean Architecture by Robert Martin, let's say I have this simplified version (not showing other stuff like Model, Gateway, Boundaries):
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:
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.
来源:https://stackoverflow.com/questions/29466292/clean-architecture-should-the-controller-talk-to-the-presenter