We need to talk about interactors

submited by
Style Pass
2023-05-26 14:30:10

I’ve noticed a bit of a trend within the Ruby community in recent years that worries me: every other codebase is now attempting to use interactors. That’s not inherently bad, but as we’ll discuss in this article, it has some unforeseen consequences. Luckily I haven’t seen much of this bleed into libraries but, on application code, it has been surprisingly common. Interestingly enough the first time I saw it my reaction was not negative at all: it looked like a very clean way to organize procedures (or commands) keeping things relatively interchangeable.

After months of extensive usage and delving deeper into the codebases, I have noticed several inherent flaws within the usage of this pattern that cannot be overlooked. Moreover, I have observed the formation of bad habits among developers who rely on this pattern. In this article we’re going to be diving into the issues that stem from it and why you should be careful when using it.

Most interactor gems say they are an implementation of the command pattern and a way to encapsulate what your application does. As wikipedia tells us, it’s a design pattern to encapsulate how to perform an action.

Leave a Comment