Open
Description
Current implementations of Interactor
pattern (#4, #51) has several flaws to consider:
- It uses hook methods (like Django's CBV) which may end up in a hook hell when your code flow gets more complex
- It promotes writing more complex code flow when you have to do something non-trivial, i.e. different handling of errors got from different parts of the business logic flow.
- Closely couples calling the interactor with the process of gathering input which might not always be the case, i.e. heartbeat-driven interactions with gathering data being part of the interactions and not the calling process.
- It presumes that there is a single source of input, represented by the
InputPort
andRequestModel
. Doesn't generalize enough about sources of data, i.e. a model got from a database repository is treated differently than the data got from request. - It doesn't promote actual modeling of the
InputPort
: a generic interface of theRequestModel
doesn't have such nicedataclass
features as domain objects got from anyRepository
. - Separation of validation and actual processing might be somewhat artificial. There's no fundamental difference between validation errors (i.e. this id is invalid) and business process errors (i.e. this item is in an invalid state).