Clean Architecture: Combining Interactors

后端 未结 3 1182
北荒
北荒 2021-02-05 08:43

I\'ve recently stumbled upon Clean Architecture, by Uncle Bob, and I\'m curious to know whether Interactors can execute other Interactors.

For example, these are my Inte

3条回答
  •  醉酒成梦
    2021-02-05 09:35

    I have been pondering the same thing and after finding very little on the subject, I have come to the conclusion "Yes" it is probably the best option.

    my reasoning as follows:

    1. Single Responsibility: If you can't aggregate use-cases, then each can't really be single responsibility. Without aggregation, it means domain logic ends up in the presentation layer, defeating the purpose.
    2. DRY: use cases can be shared, and should be where it makes sense.

    To preserve single responsibility, I would consider limiting aggregating use-cases to do only that, i.e. executing those use cases and doing any final transformations.

    Given the age of this question, I'd be interested to know which way you went with this and issues you encountered.

提交回复
热议问题